1 """Support for Oncue sensors."""
3 from __future__
import annotations
5 from aiooncue
import OncueDevice, OncueSensor
13 DataUpdateCoordinator,
16 from .const
import CONNECTION_ESTABLISHED_KEY, DOMAIN, VALUE_UNAVAILABLE
20 CoordinatorEntity[DataUpdateCoordinator[dict[str, OncueDevice]]], Entity
22 """Representation of an Oncue entity."""
24 _attr_has_entity_name =
True
28 coordinator: DataUpdateCoordinator[dict[str, OncueDevice]],
32 description: EntityDescription,
34 """Initialize the sensor."""
41 identifiers={(DOMAIN, device_id)},
43 hw_version=device.hardware_version,
44 sw_version=device.sensors[
"FirmwareVersion"].display_value,
45 model=device.sensors[
"GensetModelNumberSelect"].display_value,
46 manufacturer=
"Kohler",
49 mac_address_hex = hex(
int(device.sensors[
"MacAddress"].value))[2:]
53 (dr.CONNECTION_NETWORK_MAC, mac_address_hex)
58 """Return the sensor value."""
59 device: OncueDevice = self.coordinator.data[self.
_device_id_device_id]
65 """Return if entity is available."""
75 device: OncueDevice = self.coordinator.data[self.
_device_id_device_id]
76 conn_established: OncueSensor = device.sensors[CONNECTION_ESTABLISHED_KEY]
78 conn_established
is not None
79 and conn_established.value == VALUE_UNAVAILABLE
82 return super().available
None __init__(self, DataUpdateCoordinator[dict[str, OncueDevice]] coordinator, str device_id, OncueDevice device, OncueSensor sensor, EntityDescription description)