Home Assistant Unofficial Reference
2024.12.1
entity.py
Go to the documentation of this file.
1
"""Base class for Touchline SL zone entities."""
2
3
from
pytouchlinesl
import
Zone
4
5
from
homeassistant.helpers.device_registry
import
DeviceInfo
6
from
homeassistant.helpers.update_coordinator
import
CoordinatorEntity
7
8
from
.const
import
DOMAIN
9
from
.coordinator
import
TouchlineSLModuleCoordinator
10
11
12
class
TouchlineSLZoneEntity
(
CoordinatorEntity
[TouchlineSLModuleCoordinator]):
13
"""Defines a base Touchline SL zone entity."""
14
15
_attr_has_entity_name =
True
16
17
def
__init__
(self, coordinator: TouchlineSLModuleCoordinator, zone_id: int) ->
None
:
18
"""Initialize touchline entity."""
19
super().
__init__
(coordinator)
20
self.
zone_id
zone_id = zone_id
21
self.
_attr_device_info
_attr_device_info =
DeviceInfo
(
22
identifiers={(DOMAIN,
str
(zone_id))},
23
name=self.
zone
zone.name,
24
manufacturer=
"Roth"
,
25
via_device=(DOMAIN, coordinator.data.module.id),
26
model=
"zone"
,
27
suggested_area=self.
zone
zone.name,
28
)
29
30
@property
31
def
zone
(self) -> Zone:
32
"""Return the device object from the coordinator data."""
33
return
self.coordinator.data.zones[self.
zone_id
zone_id]
34
35
@property
36
def
available
(self) -> bool:
37
"""Return if the device is available."""
38
return
super().available
and
self.
zone_id
zone_id
in
self.coordinator.data.zones
homeassistant.components.touchline_sl.entity.TouchlineSLZoneEntity
Definition:
entity.py:12
homeassistant.components.touchline_sl.entity.TouchlineSLZoneEntity.__init__
None __init__(self, TouchlineSLModuleCoordinator coordinator, int zone_id)
Definition:
entity.py:17
homeassistant.components.touchline_sl.entity.TouchlineSLZoneEntity._attr_device_info
_attr_device_info
Definition:
entity.py:21
homeassistant.components.touchline_sl.entity.TouchlineSLZoneEntity.available
bool available(self)
Definition:
entity.py:36
homeassistant.components.touchline_sl.entity.TouchlineSLZoneEntity.zone
Zone zone(self)
Definition:
entity.py:31
homeassistant.components.touchline_sl.entity.TouchlineSLZoneEntity.zone_id
zone_id
Definition:
entity.py:20
homeassistant.helpers.device_registry.DeviceInfo
Definition:
device_registry.py:98
homeassistant.helpers.update_coordinator.CoordinatorEntity
Definition:
update_coordinator.py:568
homeassistant.components.bond.const.str
str
Definition:
const.py:7
homeassistant.helpers.device_registry
Definition:
device_registry.py:1
homeassistant.helpers.update_coordinator
Definition:
update_coordinator.py:1
core
homeassistant
components
touchline_sl
entity.py
Generated by
1.9.1