mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Fix Mill issue, where no sensors were shown (#137521)
Fix mill issue #137477 Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
This commit is contained in:
parent
8654597e25
commit
4deffb233d
@ -105,10 +105,8 @@ class MillHeater(MillBaseEntity, ClimateEntity):
|
||||
self, coordinator: MillDataUpdateCoordinator, device: mill.Heater
|
||||
) -> None:
|
||||
"""Initialize the thermostat."""
|
||||
|
||||
super().__init__(coordinator, device)
|
||||
self._attr_unique_id = device.device_id
|
||||
self._update_attr(device)
|
||||
super().__init__(coordinator, device)
|
||||
|
||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperature."""
|
||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
|
||||
from mill import Heater, MillDevice
|
||||
from mill import MillDevice
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
@ -45,7 +45,7 @@ class MillBaseEntity(CoordinatorEntity[MillDataUpdateCoordinator]):
|
||||
|
||||
@abstractmethod
|
||||
@callback
|
||||
def _update_attr(self, device: MillDevice | Heater) -> None:
|
||||
def _update_attr(self, device: MillDevice) -> None:
|
||||
"""Update the attribute of the entity."""
|
||||
|
||||
@property
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from mill import MillDevice
|
||||
from mill import Heater, MillDevice
|
||||
|
||||
from homeassistant.components.number import NumberDeviceClass, NumberEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@ -27,6 +27,7 @@ async def async_setup_entry(
|
||||
async_add_entities(
|
||||
MillNumber(mill_data_coordinator, mill_device)
|
||||
for mill_device in mill_data_coordinator.data.values()
|
||||
if isinstance(mill_device, Heater)
|
||||
)
|
||||
|
||||
|
||||
@ -45,9 +46,8 @@ class MillNumber(MillBaseEntity, NumberEntity):
|
||||
mill_device: MillDevice,
|
||||
) -> None:
|
||||
"""Initialize the number."""
|
||||
super().__init__(coordinator, mill_device)
|
||||
self._attr_unique_id = f"{mill_device.device_id}_max_heating_power"
|
||||
self._update_attr(mill_device)
|
||||
super().__init__(coordinator, mill_device)
|
||||
|
||||
@callback
|
||||
def _update_attr(self, device: MillDevice) -> None:
|
||||
|
@ -192,9 +192,9 @@ class MillSensor(MillBaseEntity, SensorEntity):
|
||||
mill_device: mill.Socket | mill.Heater,
|
||||
) -> None:
|
||||
"""Initialize the sensor."""
|
||||
super().__init__(coordinator, mill_device)
|
||||
self.entity_description = entity_description
|
||||
self._attr_unique_id = f"{mill_device.device_id}_{entity_description.key}"
|
||||
super().__init__(coordinator, mill_device)
|
||||
|
||||
@callback
|
||||
def _update_attr(self, device):
|
||||
|
Loading…
x
Reference in New Issue
Block a user