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
3 changed files with 25 additions and 1 deletions
|
@ -265,3 +265,8 @@ class DaikinClimate(ClimateDevice):
|
|||
def update(self):
|
||||
"""Retrieve latest state."""
|
||||
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.const import CONF_HOSTS
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
|
@ -129,4 +130,17 @@ class DaikinApi:
|
|||
@property
|
||||
def mac(self):
|
||||
"""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):
|
||||
"""Retrieve latest state."""
|
||||
self._api.update()
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
"""Return a device description for device registry."""
|
||||
return self._api.device_info
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue