Home Assistant Unofficial Reference
2024.12.1
entity.py
Go to the documentation of this file.
1
"""Base Entity for JustNimbus sensors."""
2
3
from
__future__
import
annotations
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
JustNimbusCoordinator
10
11
12
class
JustNimbusEntity
(
13
CoordinatorEntity[JustNimbusCoordinator],
14
):
15
"""Defines a base JustNimbus entity."""
16
17
_attr_has_entity_name =
True
18
19
def
__init__
(
20
self,
21
*,
22
device_id: str,
23
coordinator: JustNimbusCoordinator,
24
) ->
None
:
25
"""Initialize the JustNimbus entity."""
26
super().
__init__
(coordinator=coordinator)
27
self.
_attr_device_info
_attr_device_info =
DeviceInfo
(
28
identifiers={(DOMAIN, device_id)},
29
name=
"JustNimbus Sensor"
,
30
manufacturer=
"JustNimbus"
,
31
)
32
33
@property
34
def
available
(self) -> bool:
35
"""Return device availability."""
36
return
super().available
and
self.coordinator.data
is
not
None
homeassistant.components.justnimbus.entity.JustNimbusEntity
Definition:
entity.py:14
homeassistant.components.justnimbus.entity.JustNimbusEntity.available
bool available(self)
Definition:
entity.py:34
homeassistant.components.justnimbus.entity.JustNimbusEntity._attr_device_info
_attr_device_info
Definition:
entity.py:27
homeassistant.components.justnimbus.entity.JustNimbusEntity.__init__
None __init__(self, *str device_id, JustNimbusCoordinator coordinator)
Definition:
entity.py:24
homeassistant.helpers.device_registry.DeviceInfo
Definition:
device_registry.py:98
homeassistant.helpers.device_registry
Definition:
device_registry.py:1
homeassistant.helpers.update_coordinator
Definition:
update_coordinator.py:1
core
homeassistant
components
justnimbus
entity.py
Generated by
1.9.1