Bump mill-local to 0.1.1 and add device info (#63141)

pull/63167/head
Daniel Hjelseth Høyer 2021-12-31 23:33:50 +01:00 committed by GitHub
parent 8e5c8c516d
commit 4f6b2e6e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 3 deletions

View File

@ -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):

View File

@ -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"

View File

@ -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):

View File

@ -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

View File

@ -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