diff --git a/custom_components/hon/binary_sensor.py b/custom_components/hon/binary_sensor.py index c54d917..4e340d3 100644 --- a/custom_components/hon/binary_sensor.py +++ b/custom_components/hon/binary_sensor.py @@ -123,6 +123,14 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = { icon="mdi:power-cycle", translation_key="on", ), + HonBinarySensorEntityDescription( + key="attributes.parameters.preheatStatus", + name="Pre-Heat", + device_class=BinarySensorDeviceClass.RUNNING, + on_value=1, + icon="mdi:thermometer-chevron-up", + translation_key="pre_heat", + ), ), "IH": ( HonBinarySensorEntityDescription( @@ -334,16 +342,15 @@ class HonBinarySensorEntity(HonEntity, BinarySensorEntity): @property def is_on(self) -> bool: - return bool( - self._device.get(self.entity_description.key, "") - == self.entity_description.on_value - ) + attr = self._device.get(self.entity_description.key, None) + value = attr.value if hasattr(attr, "value") else attr + return value == self.entity_description.on_value + @callback def _handle_coordinator_update(self, update: bool = True) -> None: - self._attr_native_value = ( - self._device.get(self.entity_description.key, "") - == self.entity_description.on_value - ) + attr = self._device.get(self.entity_description.key, None) + value = attr.value if hasattr(attr, "value") else attr + self._attr_native_value = (value == self.entity_description.on_value) if update: self.schedule_update_ha_state()