(self)
return value
Return the state value of this capability for this entity.
Return the state value of this capability for this entity.
Return the state value of this capability for this entity .
def get_value(self) -> float | str | None:
        """Return the state value of this capability for this entity."""
        if not self.retrievable:
            return None

        entity_state = self.state

        if self.state_entity_id:
            entity_state = self.hass.states.get(self.state_entity_id)
            if not entity_state:
                raise SmartHomeError(
                    ERR_DEVICE_UNREACHABLE,
                    f'Entity {self.state_entity_id} not found for {self.instance} instance of {self.state.entity_id}'
                )

        if self.state_value_attribute:
            value = entity_state.attributes.get(self.state_value_attribute)
        else:
            value = entity_state.state

        return value
def get_value ( self ) -> float | str | None : if not self . retrievable : return None entity_state = self . state if self . state_entity_id : entity_state = self . hass . states . get ( self . state_entity_id ) if not entity_state : raise SmartHomeError ( ERR_DEVICE_UNREACHABLE , f'Entity {self.state_entity_id} not found for {self.instance} instance of {self.state.entity_id}' ) if self . state_value_attribute : value = entity_state . attributes . get ( self . state_value_attribute ) else : value = entity_state . state return value