Home Assistant Unofficial Reference
2024.12.1
entity.py
Go to the documentation of this file.
1
"""Aquacell entity."""
2
3
from
aioaquacell
import
Softener
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
AquacellCoordinator
10
11
12
class
AquacellEntity
(
CoordinatorEntity
[AquacellCoordinator]):
13
"""Representation of an aquacell entity."""
14
15
_attr_has_entity_name =
True
16
17
def
__init__
(
18
self,
19
coordinator: AquacellCoordinator,
20
softener_key: str,
21
entity_key: str,
22
) ->
None
:
23
"""Initialize the aquacell entity."""
24
super().
__init__
(coordinator)
25
26
self.
softener_key
softener_key = softener_key
27
28
self.
_attr_unique_id
_attr_unique_id = f
"{softener_key}-{entity_key}"
29
self.
_attr_device_info
_attr_device_info =
DeviceInfo
(
30
name=self.
softener
softener.name,
31
hw_version=self.
softener
softener.fwVersion,
32
identifiers={(DOMAIN,
str
(softener_key))},
33
manufacturer=self.
softener
softener.brand,
34
model=self.
softener
softener.ssn,
35
serial_number=softener_key,
36
)
37
38
@property
39
def
softener
(self) -> Softener:
40
"""Handle updated data from the coordinator."""
41
return
self.coordinator.data[self.
softener_key
softener_key]
homeassistant.components.aquacell.entity.AquacellEntity
Definition:
entity.py:12
homeassistant.components.aquacell.entity.AquacellEntity._attr_unique_id
_attr_unique_id
Definition:
entity.py:28
homeassistant.components.aquacell.entity.AquacellEntity._attr_device_info
_attr_device_info
Definition:
entity.py:29
homeassistant.components.aquacell.entity.AquacellEntity.softener_key
softener_key
Definition:
entity.py:26
homeassistant.components.aquacell.entity.AquacellEntity.softener
Softener softener(self)
Definition:
entity.py:39
homeassistant.components.aquacell.entity.AquacellEntity.__init__
None __init__(self, AquacellCoordinator coordinator, str softener_key, str entity_key)
Definition:
entity.py:22
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
aquacell
entity.py
Generated by
1.9.1