Fix the Hydrawise status sensor (#99271)

This commit is contained in:
David Knowles 2023-09-06 10:51:27 -04:00 committed by GitHub
parent c9a6ea94a7
commit 0b95e4ac17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,7 +90,7 @@ class HydrawiseBinarySensor(HydrawiseEntity, BinarySensorEntity):
"""Get the latest data and updates the state."""
LOGGER.debug("Updating Hydrawise binary sensor: %s", self.name)
if self.entity_description.key == "status":
self._attr_is_on = self.coordinator.api.status == "All good!"
self._attr_is_on = self.coordinator.last_update_success
elif self.entity_description.key == "is_watering":
relay_data = self.coordinator.api.relays_by_zone_number[self.data["relay"]]
self._attr_is_on = relay_data["timestr"] == "Now"