1 """An entity class for mobile_app."""
3 from __future__
import annotations
14 ATTR_SENSOR_ATTRIBUTES,
15 ATTR_SENSOR_DEVICE_CLASS,
17 ATTR_SENSOR_ENTITY_CATEGORY,
20 ATTR_SENSOR_STATE_CLASS,
23 from .helpers
import device_info
27 """Representation of a mobile app entity."""
29 _attr_should_poll =
False
31 def __init__(self, config: dict, entry: ConfigEntry) ->
None:
32 """Initialize the entity."""
45 """Update the entity from the config."""
52 self.
_attr_available_attr_available = config.get(ATTR_SENSOR_STATE) != STATE_UNAVAILABLE
55 """Register callbacks."""
59 f
"{SIGNAL_SENSOR_UPDATE}-{self._attr_unique_id}",
70 """Restore previous state."""
72 config[ATTR_SENSOR_STATE] = last_state.state
73 config[ATTR_SENSOR_ATTRIBUTES] = {
74 **last_state.attributes,
75 **self.
_config_config[ATTR_SENSOR_ATTRIBUTES],
77 if ATTR_ICON
in last_state.attributes:
78 config[ATTR_SENSOR_ICON] = last_state.attributes[ATTR_ICON]
82 """Return device registry information for this entity."""
87 """Handle async event updates."""
None async_restore_last_state(self, State last_state)
_attr_entity_registry_enabled_default
None __init__(self, dict config, ConfigEntry entry)
None _async_update_attr_from_config(self)
None async_added_to_hass(self)
_attr_extra_state_attributes
None _handle_update(self, dict[str, Any] data)
None async_write_ha_state(self)
None async_on_remove(self, CALLBACK_TYPE func)
State|None async_get_last_state(self)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)