def _element_changed(self, element, changeset): if self._element.definition == ZoneType.TEMPERATURE.value: self._state = temperature_to_state(self._element.temperature, -60) elif self._element.definition == ZoneType.ANALOG_ZONE.value: self._state = self._element.voltage else: self._state = pretty_const( ZoneLogicalStatus(self._element.logical_status).name)
def _element_changed(self, _: Element, changeset: Any) -> None: if self._element.definition == ZoneType.TEMPERATURE.value: self._state = temperature_to_state(self._element.temperature, UNDEFINED_TEMPERATURE) elif self._element.definition == ZoneType.ANALOG_ZONE.value: self._state = f"{self._element.voltage}" else: self._state = pretty_const( ZoneLogicalStatus(self._element.logical_status).name)
def extra_state_attributes(self): """Attributes of the sensor.""" attrs = self.initial_attrs() attrs["physical_status"] = ZonePhysicalStatus( self._element.physical_status).name.lower() attrs["logical_status"] = ZoneLogicalStatus( self._element.logical_status).name.lower() attrs["definition"] = ZoneType(self._element.definition).name.lower() attrs["area"] = self._element.area + 1 attrs["triggered_alarm"] = self._element.triggered_alarm return attrs
def device_state_attributes(self): """Attributes of the sensor.""" from elkm1_lib.const import (ZoneLogicalStatus, ZonePhysicalStatus, ZoneType) attrs = self.initial_attrs() attrs['physical_status'] = ZonePhysicalStatus( self._element.physical_status).name.lower() attrs['logical_status'] = ZoneLogicalStatus( self._element.logical_status).name.lower() attrs['definition'] = ZoneType(self._element.definition).name.lower() attrs['area'] = self._element.area + 1 attrs['bypassed'] = self._element.bypassed attrs['triggered_alarm'] = self._element.triggered_alarm return attrs
def device_state_attributes(self): """Attributes of the sensor.""" from elkm1_lib.const import ZoneLogicalStatus, ZonePhysicalStatus, ZoneType attrs = self.initial_attrs() attrs["physical_status"] = ZonePhysicalStatus( self._element.physical_status ).name.lower() attrs["logical_status"] = ZoneLogicalStatus( self._element.logical_status ).name.lower() attrs["definition"] = ZoneType(self._element.definition).name.lower() attrs["area"] = self._element.area + 1 attrs["bypassed"] = self._element.bypassed attrs["triggered_alarm"] = self._element.triggered_alarm return attrs