From 4f6b2e6e1cdd46af29589be2aceb05176c199560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Fri, 31 Dec 2021 23:33:50 +0100 Subject: [PATCH] Bump mill-local to 0.1.1 and add device info (#63141) --- homeassistant/components/mill/climate.py | 13 +++++++++++++ homeassistant/components/mill/manifest.json | 2 +- homeassistant/components/mill/sensor.py | 12 ++++++++++++ requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/mill/climate.py b/homeassistant/components/mill/climate.py index a6cfbb8cb7a..f78133d8e5b 100644 --- a/homeassistant/components/mill/climate.py +++ b/homeassistant/components/mill/climate.py @@ -21,6 +21,7 @@ from homeassistant.const import ( ) from homeassistant.core import ServiceCall, callback from homeassistant.helpers import config_validation as cv +from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity @@ -204,6 +205,18 @@ class LocalMillHeater(CoordinatorEntity, ClimateEntity): """Initialize the thermostat.""" super().__init__(coordinator) self._attr_name = coordinator.mill_data_connection.name + if coordinator.mill_data_connection.mac_address: + mac = self.coordinator.mill_data_connection.mac_address + self._attr_unique_id = mac + self._attr_device_info = DeviceInfo( + connections={(CONNECTION_NETWORK_MAC, mac)}, + configuration_url=self.coordinator.mill_data_connection.url, + manufacturer=MANUFACTURER, + model="Generation 3", + name=coordinator.mill_data_connection.name, + sw_version=coordinator.mill_data_connection.version, + ) + self._update_attr() async def async_set_temperature(self, **kwargs): diff --git a/homeassistant/components/mill/manifest.json b/homeassistant/components/mill/manifest.json index 9cb220b06dc..7cea7118882 100644 --- a/homeassistant/components/mill/manifest.json +++ b/homeassistant/components/mill/manifest.json @@ -2,7 +2,7 @@ "domain": "mill", "name": "Mill", "documentation": "https://www.home-assistant.io/integrations/mill", - "requirements": ["millheater==0.9.0", "mill-local==0.1.0"], + "requirements": ["millheater==0.9.0", "mill-local==0.1.1"], "codeowners": ["@danielhiversen"], "config_flow": true, "iot_class": "local_polling" diff --git a/homeassistant/components/mill/sensor.py b/homeassistant/components/mill/sensor.py index dd2aedabf28..5925650ed65 100644 --- a/homeassistant/components/mill/sensor.py +++ b/homeassistant/components/mill/sensor.py @@ -20,6 +20,7 @@ from homeassistant.const import ( TEMP_CELSIUS, ) from homeassistant.core import callback +from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.entity import DeviceInfo, EntityCategory from homeassistant.helpers.update_coordinator import CoordinatorEntity @@ -202,6 +203,17 @@ class LocalMillSensor(CoordinatorEntity, SensorEntity): self._attr_name = ( f"{coordinator.mill_data_connection.name} {entity_description.name}" ) + if coordinator.mill_data_connection.mac_address: + mac = self.coordinator.mill_data_connection.mac_address + self._attr_unique_id = f"{mac}_{entity_description.key}" + self._attr_device_info = DeviceInfo( + connections={(CONNECTION_NETWORK_MAC, mac)}, + configuration_url=self.coordinator.mill_data_connection.url, + manufacturer=MANUFACTURER, + model="Generation 3", + name=coordinator.mill_data_connection.name, + sw_version=coordinator.mill_data_connection.version, + ) @property def native_value(self): diff --git a/requirements_all.txt b/requirements_all.txt index d1eebe2645b..a7cd0004471 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1019,7 +1019,7 @@ micloud==0.4 miflora==0.7.0 # homeassistant.components.mill -mill-local==0.1.0 +mill-local==0.1.1 # homeassistant.components.mill millheater==0.9.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 6c4c12018ae..e037e138f3d 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -622,7 +622,7 @@ mficlient==0.3.0 micloud==0.4 # homeassistant.components.mill -mill-local==0.1.0 +mill-local==0.1.1 # homeassistant.components.mill millheater==0.9.0