Use DeviceInfo in zwave-js (#58649)
This commit is contained in:
parent
e10bd39827
commit
c8cbd0070d
2 changed files with 8 additions and 7 deletions
|
@ -10,7 +10,7 @@ from zwave_js_server.model.value import Value as ZwaveValue, get_value_id
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import DOMAIN
|
||||
from .discovery import ZwaveDiscoveryInfo
|
||||
|
@ -54,9 +54,9 @@ class ZWaveBaseEntity(Entity):
|
|||
)
|
||||
self._attr_assumed_state = self.info.assumed_state
|
||||
# device is precreated in main handler
|
||||
self._attr_device_info = {
|
||||
"identifiers": {get_device_id(self.client, self.info.node)},
|
||||
}
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={get_device_id(self.client, self.info.node)},
|
||||
)
|
||||
|
||||
@callback
|
||||
def on_value_update(self) -> None:
|
||||
|
|
|
@ -47,6 +47,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_platform
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import (
|
||||
|
@ -476,9 +477,9 @@ class ZWaveNodeStatusSensor(SensorEntity):
|
|||
f"{self.client.driver.controller.home_id}.{node.node_id}.node_status"
|
||||
)
|
||||
# device is precreated in main handler
|
||||
self._attr_device_info = {
|
||||
"identifiers": {get_device_id(self.client, self.node)},
|
||||
}
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={get_device_id(self.client, self.node)},
|
||||
)
|
||||
self._attr_native_value: str = node.status.name.lower()
|
||||
|
||||
async def async_poll_value(self, _: bool) -> None:
|
||||
|
|
Loading…
Add table
Reference in a new issue