mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add device_info to Daikin (#19372)
* add device_info to Daikin * Use the constant CONNECTION_NETWORK_MAC from the device registry helper.
This commit is contained in:
parent
7f0dd442fd
commit
e5487722a8
@ -265,3 +265,8 @@ class DaikinClimate(ClimateDevice):
|
|||||||
def update(self):
|
def update(self):
|
||||||
"""Retrieve latest state."""
|
"""Retrieve latest state."""
|
||||||
self._api.update()
|
self._api.update()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
"""Return a device description for device registry."""
|
||||||
|
return self._api.device_info
|
||||||
|
@ -15,6 +15,7 @@ import voluptuous as vol
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_HOSTS
|
from homeassistant.const import CONF_HOSTS
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
@ -129,4 +130,17 @@ class DaikinApi:
|
|||||||
@property
|
@property
|
||||||
def mac(self):
|
def mac(self):
|
||||||
"""Return mac-address of device."""
|
"""Return mac-address of device."""
|
||||||
return self.device.values.get('mac')
|
return self.device.values.get(CONNECTION_NETWORK_MAC)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
"""Return a device description for device registry."""
|
||||||
|
info = self.device.values
|
||||||
|
return {
|
||||||
|
'connections': {(CONNECTION_NETWORK_MAC, self.mac)},
|
||||||
|
'identifieres': self.mac,
|
||||||
|
'manufacturer': 'Daikin',
|
||||||
|
'model': info.get('model'),
|
||||||
|
'name': info.get('name'),
|
||||||
|
'sw_version': info.get('ver').replace('_', '.'),
|
||||||
|
}
|
||||||
|
@ -104,3 +104,8 @@ class DaikinClimateSensor(Entity):
|
|||||||
def update(self):
|
def update(self):
|
||||||
"""Retrieve latest state."""
|
"""Retrieve latest state."""
|
||||||
self._api.update()
|
self._api.update()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
"""Return a device description for device registry."""
|
||||||
|
return self._api.device_info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user