Skip to content

Commit

Permalink
Don't create battery sensors for devices which do not report a batter…
Browse files Browse the repository at this point in the history
…y state. Fixes #61
  • Loading branch information
sebr committed Apr 29, 2021
1 parent eb7a245 commit 0287889
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/bhyve/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ async def async_setup_platform(hass, config, async_add_entities, _discovery_info
devices = await bhyve.devices
for device in devices:
if device.get("type") == DEVICE_SPRINKLER:
sensors.append(BHyveBatterySensor(hass, bhyve, device))
sensors.append(BHyveStateSensor(hass, bhyve, device))
for zone in device.get("zones"):
sensors.append(BHyveZoneHistorySensor(hass, bhyve, device, zone))

if device.get("battery", None) is not None:
sensors.append(BHyveBatterySensor(hass, bhyve, device))

async_add_entities(sensors, True)


Expand Down

0 comments on commit 0287889

Please sign in to comment.