Home Assistant Unofficial Reference
2024.12.1
entity.py
Go to the documentation of this file.
1
"""Adapter to wrap the pyjuicenet api for home assistant."""
2
3
from
pyjuicenet
import
Charger
4
5
from
homeassistant.helpers.device_registry
import
DeviceInfo
6
from
homeassistant.helpers.update_coordinator
import
(
7
CoordinatorEntity,
8
DataUpdateCoordinator,
9
)
10
11
from
.const
import
DOMAIN
12
13
14
class
JuiceNetDevice
(
CoordinatorEntity
):
15
"""Represent a base JuiceNet device."""
16
17
_attr_has_entity_name =
True
18
19
def
__init__
(
20
self, device: Charger, key: str, coordinator: DataUpdateCoordinator
21
) ->
None
:
22
"""Initialise the sensor."""
23
super().
__init__
(coordinator)
24
self.
device
device = device
25
self.
key
key = key
26
self.
_attr_unique_id
_attr_unique_id = f
"{device.id}-{key}"
27
self.
_attr_device_info
_attr_device_info =
DeviceInfo
(
28
configuration_url=(
29
f
"https://home.juice.net/Portal/Details?unitID={device.id}"
30
),
31
identifiers={(DOMAIN, device.id)},
32
manufacturer=
"JuiceNet"
,
33
name=device.name,
34
)
homeassistant.components.juicenet.entity.JuiceNetDevice
Definition:
entity.py:14
homeassistant.components.juicenet.entity.JuiceNetDevice._attr_unique_id
_attr_unique_id
Definition:
entity.py:26
homeassistant.components.juicenet.entity.JuiceNetDevice.device
device
Definition:
entity.py:24
homeassistant.components.juicenet.entity.JuiceNetDevice._attr_device_info
_attr_device_info
Definition:
entity.py:27
homeassistant.components.juicenet.entity.JuiceNetDevice.__init__
None __init__(self, Charger device, str key, DataUpdateCoordinator coordinator)
Definition:
entity.py:21
homeassistant.components.juicenet.entity.JuiceNetDevice.key
key
Definition:
entity.py:25
homeassistant.helpers.device_registry.DeviceInfo
Definition:
device_registry.py:98
homeassistant.helpers.update_coordinator.CoordinatorEntity
Definition:
update_coordinator.py:568
homeassistant.helpers.device_registry
Definition:
device_registry.py:1
homeassistant.helpers.update_coordinator
Definition:
update_coordinator.py:1
core
homeassistant
components
juicenet
entity.py
Generated by
1.9.1