From a1bfc46e6cfa351614952888c942fd002c536097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Wed, 18 Dec 2024 21:04:23 +0100 Subject: [PATCH] Mill connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Hjelseth Høyer --- homeassistant/components/mill/__init__.py | 13 ------------- homeassistant/components/mill/climate.py | 3 ++- homeassistant/components/mill/sensor.py | 3 ++- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/homeassistant/components/mill/__init__.py b/homeassistant/components/mill/__init__.py index dd0c4035dd7..11199e126cf 100644 --- a/homeassistant/components/mill/__init__.py +++ b/homeassistant/components/mill/__init__.py @@ -11,7 +11,6 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_USERNAME, Platform from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady -from homeassistant.helpers import device_registry as dr from homeassistant.helpers.aiohttp_client import async_get_clientsession from .const import CLOUD, CONNECTION_TYPE, DOMAIN, LOCAL @@ -56,18 +55,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: await data_coordinator.async_config_entry_first_refresh() hass.data[DOMAIN][conn_type][key] = data_coordinator - if entry.data.get(CONNECTION_TYPE) == CLOUD: - device_registry = dr.async_get(hass) - for mill_device in mill_data_connection.devices.values(): - # migrate to new device ids - device_entry = device_registry.async_get_device( - identifiers={(DOMAIN, mill_device.device_id)} - ) - if device_entry and entry.entry_id in device_entry.config_entries: - device_registry.async_update_device( - device_entry.id, new_identifiers={(DOMAIN, mill_device.mac_address)} - ) - await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) return True diff --git a/homeassistant/components/mill/climate.py b/homeassistant/components/mill/climate.py index a4f0ef04755..492f5b015e6 100644 --- a/homeassistant/components/mill/climate.py +++ b/homeassistant/components/mill/climate.py @@ -113,7 +113,8 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): self._id = heater.device_id self._attr_unique_id = heater.device_id self._attr_device_info = DeviceInfo( - identifiers={(DOMAIN, heater.mac_address)}, + connections={(CONNECTION_NETWORK_MAC, heater.mac_address)}, + identifiers={(DOMAIN, heater.device_id)}, manufacturer=MANUFACTURER, model=heater.model, name=heater.name, diff --git a/homeassistant/components/mill/sensor.py b/homeassistant/components/mill/sensor.py index 2ef14204f2e..e92c7e80129 100644 --- a/homeassistant/components/mill/sensor.py +++ b/homeassistant/components/mill/sensor.py @@ -193,7 +193,8 @@ class MillSensor(CoordinatorEntity, SensorEntity): self._available = False self._attr_unique_id = f"{mill_device.device_id}_{entity_description.key}" self._attr_device_info = DeviceInfo( - identifiers={(DOMAIN, mill_device.mac_address)}, + connections={(CONNECTION_NETWORK_MAC, mill_device.mac_address)}, + identifiers={(DOMAIN, mill_device.device_id)}, name=mill_device.name, manufacturer=MANUFACTURER, model=mill_device.model,