1 """The Nibe Heat Pump sensors."""
3 from __future__
import annotations
5 from nibe.coil
import Coil, CoilData
11 SensorEntityDescription,
17 UnitOfElectricCurrent,
18 UnitOfElectricPotential,
28 from .const
import DOMAIN
29 from .coordinator
import CoilCoordinator
30 from .entity
import CoilEntity
35 entity_category=EntityCategory.DIAGNOSTIC,
36 device_class=SensorDeviceClass.TEMPERATURE,
37 state_class=SensorStateClass.MEASUREMENT,
38 native_unit_of_measurement=UnitOfTemperature.CELSIUS,
42 entity_category=EntityCategory.DIAGNOSTIC,
43 device_class=SensorDeviceClass.TEMPERATURE,
44 state_class=SensorStateClass.MEASUREMENT,
45 native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
49 entity_category=EntityCategory.DIAGNOSTIC,
50 device_class=SensorDeviceClass.CURRENT,
51 state_class=SensorStateClass.MEASUREMENT,
52 native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
56 entity_category=EntityCategory.DIAGNOSTIC,
57 device_class=SensorDeviceClass.CURRENT,
58 state_class=SensorStateClass.MEASUREMENT,
59 native_unit_of_measurement=UnitOfElectricCurrent.MILLIAMPERE,
63 entity_category=EntityCategory.DIAGNOSTIC,
64 device_class=SensorDeviceClass.VOLTAGE,
65 state_class=SensorStateClass.MEASUREMENT,
66 native_unit_of_measurement=UnitOfElectricPotential.VOLT,
70 entity_category=EntityCategory.DIAGNOSTIC,
71 device_class=SensorDeviceClass.VOLTAGE,
72 state_class=SensorStateClass.MEASUREMENT,
73 native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT,
77 entity_category=EntityCategory.DIAGNOSTIC,
78 device_class=SensorDeviceClass.POWER,
79 state_class=SensorStateClass.MEASUREMENT,
80 native_unit_of_measurement=UnitOfPower.WATT,
84 entity_category=EntityCategory.DIAGNOSTIC,
85 device_class=SensorDeviceClass.POWER,
86 state_class=SensorStateClass.MEASUREMENT,
87 native_unit_of_measurement=UnitOfPower.KILO_WATT,
91 entity_category=EntityCategory.DIAGNOSTIC,
92 device_class=SensorDeviceClass.ENERGY,
93 state_class=SensorStateClass.TOTAL_INCREASING,
94 native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
98 entity_category=EntityCategory.DIAGNOSTIC,
99 device_class=SensorDeviceClass.ENERGY,
100 state_class=SensorStateClass.TOTAL_INCREASING,
101 native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
105 entity_category=EntityCategory.DIAGNOSTIC,
106 device_class=SensorDeviceClass.ENERGY,
107 state_class=SensorStateClass.TOTAL_INCREASING,
108 native_unit_of_measurement=UnitOfEnergy.MEGA_WATT_HOUR,
112 entity_category=EntityCategory.DIAGNOSTIC,
113 device_class=SensorDeviceClass.DURATION,
114 state_class=SensorStateClass.TOTAL_INCREASING,
115 native_unit_of_measurement=UnitOfTime.HOURS,
119 entity_category=EntityCategory.DIAGNOSTIC,
120 device_class=SensorDeviceClass.FREQUENCY,
121 state_class=SensorStateClass.MEASUREMENT,
122 native_unit_of_measurement=UnitOfFrequency.HERTZ,
129 config_entry: ConfigEntry,
130 async_add_entities: AddEntitiesCallback,
132 """Set up platform."""
134 coordinator: CoilCoordinator = hass.data[DOMAIN][config_entry.entry_id]
137 Sensor(coordinator, coil, UNIT_DESCRIPTIONS.get(coil.unit))
138 for coil
in coordinator.coils
139 if not coil.is_writable
and not coil.is_boolean
148 coordinator: CoilCoordinator,
150 entity_description: SensorEntityDescription |
None,
152 """Initialize entity."""
153 super().
__init__(coordinator, coil, ENTITY_ID_FORMAT)
154 if entity_description:
_attr_native_unit_of_measurement
None __init__(self, CoilCoordinator coordinator, Coil coil, SensorEntityDescription|None entity_description)
def _async_read_coil(self, CoilData data)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)