Add mac address as connection for Sensibo devices (#67035)
parent
a4a5057b0b
commit
2a2f245ae8
|
@ -35,6 +35,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
@ -146,6 +147,7 @@ class SensiboClimate(CoordinatorEntity, ClimateEntity):
|
|||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, coordinator.data[device_id]["id"])},
|
||||
name=coordinator.data[device_id]["name"],
|
||||
connections={(CONNECTION_NETWORK_MAC, coordinator.data[device_id]["mac"])},
|
||||
manufacturer="Sensibo",
|
||||
configuration_url="https://home.sensibo.com/",
|
||||
model=coordinator.data[device_id]["model"],
|
||||
|
|
|
@ -47,6 +47,7 @@ class SensiboDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
device_data: dict[str, dict[str, Any]] = {}
|
||||
for dev in devices:
|
||||
unique_id = dev["id"]
|
||||
mac = dev["macAddress"]
|
||||
name = dev["room"]["name"]
|
||||
temperature = dev["measurements"].get("temperature", 0.0)
|
||||
humidity = dev["measurements"].get("humidity", 0)
|
||||
|
@ -96,6 +97,7 @@ class SensiboDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
|
||||
device_data[unique_id] = {
|
||||
"id": unique_id,
|
||||
"mac": mac,
|
||||
"name": name,
|
||||
"ac_states": ac_states,
|
||||
"temp": temperature,
|
||||
|
|
|
@ -9,6 +9,7 @@ from homeassistant.components.number import NumberEntity, NumberEntityDescriptio
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
@ -96,6 +97,7 @@ class SensiboNumber(CoordinatorEntity, NumberEntity):
|
|||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, coordinator.data[device_id]["id"])},
|
||||
name=coordinator.data[device_id]["name"],
|
||||
connections={(CONNECTION_NETWORK_MAC, coordinator.data[device_id]["mac"])},
|
||||
manufacturer="Sensibo",
|
||||
configuration_url="https://home.sensibo.com/",
|
||||
model=coordinator.data[device_id]["model"],
|
||||
|
|
Loading…
Reference in New Issue