mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Add new sensors to Mill (#130896)
* Mill sensors Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net> * Update homeassistant/components/mill/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/mill/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update const.py * Update sensor.py --------- Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net> Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
parent
4836f4af2b
commit
f9a0cc5c31
@ -57,6 +57,19 @@ HEATER_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="current_power",
|
||||
translation_key="current_power",
|
||||
device_class=SensorDeviceClass.POWER,
|
||||
native_unit_of_measurement=UnitOfPower.WATT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="control_signal",
|
||||
translation_key="control_signal",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
)
|
||||
|
||||
SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
@ -118,6 +131,16 @@ LOCAL_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
),
|
||||
)
|
||||
|
||||
SOCKET_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
SensorEntityDescription(
|
||||
key=HUMIDITY,
|
||||
device_class=SensorDeviceClass.HUMIDITY,
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
*HEATER_SENSOR_TYPES,
|
||||
)
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
@ -145,7 +168,9 @@ async def async_setup_entry(
|
||||
)
|
||||
for mill_device in mill_data_coordinator.data.values()
|
||||
for entity_description in (
|
||||
HEATER_SENSOR_TYPES
|
||||
SOCKET_SENSOR_TYPES
|
||||
if isinstance(mill_device, mill.Socket)
|
||||
else HEATER_SENSOR_TYPES
|
||||
if isinstance(mill_device, mill.Heater)
|
||||
else SENSOR_TYPES
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user