mirror of
https://github.com/home-assistant/core.git
synced 2025-07-31 17:18:23 +00:00
Mill connection
Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
This commit is contained in:
parent
9e41f7c9ba
commit
a1bfc46e6c
@ -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
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user