Skip to content

Commit

Permalink
Fix Mill issue, where no sensors were shown (#137521)
Browse files Browse the repository at this point in the history
Fix mill issue #137477

Signed-off-by: Daniel Hjelseth Høyer <[email protected]>
  • Loading branch information
Danielhiversen authored Feb 6, 2025
1 parent 8654597 commit 4deffb2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 1 addition & 3 deletions homeassistant/components/mill/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,8 @@ def __init__(
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."""
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/mill/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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
Expand Down Expand Up @@ -45,7 +45,7 @@ def _handle_coordinator_update(self) -> None:

@abstractmethod
@callback
def _update_attr(self, device: MillDevice | Heater) -> None:
def _update_attr(self, device: MillDevice) -> None:
"""Update the attribute of the entity."""

@property
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/mill/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
)


Expand All @@ -45,9 +46,8 @@ def __init__(
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:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mill/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ def __init__(
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):
Expand Down

0 comments on commit 4deffb2

Please sign in to comment.