1 """The nexia integration base entity."""
3 from typing
import TYPE_CHECKING
5 from nexia.thermostat
import NexiaThermostat
6 from nexia.zone
import NexiaThermostatZone
16 async_dispatcher_connect,
17 async_dispatcher_send,
25 SIGNAL_THERMOSTAT_UPDATE,
28 from .coordinator
import NexiaDataUpdateCoordinator
32 """Base class for nexia entities."""
34 _attr_attribution = ATTRIBUTION
36 def __init__(self, coordinator: NexiaDataUpdateCoordinator, unique_id: str) ->
None:
37 """Initialize the entity."""
43 """Base class for nexia devices attached to a thermostat."""
45 _attr_has_entity_name =
True
49 coordinator: NexiaDataUpdateCoordinator,
50 thermostat: NexiaThermostat,
53 """Initialize the entity."""
54 super().
__init__(coordinator, unique_id)
56 thermostat_id = thermostat.thermostat_id
58 configuration_url=self.coordinator.nexia_home.root_url,
59 identifiers={(DOMAIN, thermostat_id)},
60 manufacturer=MANUFACTURER,
61 model=thermostat.get_model(),
62 name=thermostat.get_name(),
63 sw_version=thermostat.get_firmware(),
68 """Listen for signals for services."""
74 self.async_write_ha_state,
79 """Signal a thermostat update.
81 Whenever the underlying library does an action against
82 a thermostat, the data for the thermostat and all
83 connected zone is updated.
85 Update all the zones on the thermostat.
91 """Return True if thermostat is available and data is available."""
92 return super().available
and self.
_thermostat_thermostat.is_online
96 """Base class for nexia devices attached to a thermostat."""
100 coordinator: NexiaDataUpdateCoordinator,
101 zone: NexiaThermostatZone,
104 """Initialize the entity."""
105 super().
__init__(coordinator, zone.thermostat, unique_id)
111 ATTR_IDENTIFIERS: {(DOMAIN, zone.zone_id)},
112 ATTR_NAME: zone_name,
113 ATTR_SUGGESTED_AREA: zone_name,
114 ATTR_VIA_DEVICE: (DOMAIN, zone.thermostat.thermostat_id),
119 """Listen for signals for services."""
121 self.async_on_remove(
125 self.async_write_ha_state,
130 """Signal a zone update.
132 Whenever the underlying library does an action against
133 a zone, the data for the zone is updated.
135 Update a single zone.
None __init__(self, NexiaDataUpdateCoordinator coordinator, str unique_id)
None async_added_to_hass(self)
None _signal_thermostat_update(self)
None __init__(self, NexiaDataUpdateCoordinator coordinator, NexiaThermostat thermostat, str unique_id)
None __init__(self, NexiaDataUpdateCoordinator coordinator, NexiaThermostatZone zone, str unique_id)
None _signal_zone_update(self)
None async_added_to_hass(self)
str get_name(AirthingsDevice device)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)
None async_dispatcher_send(HomeAssistant hass, str signal, *Any args)