Add suggested area to the Z-Wave.Me integration (#66986)

* Add Z-Wave.Me Device Info

* fix

* fix

* small fix

Co-authored-by: Dmitry Vlasov <kerbalspacema@gmail.com>
pull/67104/head
Poltorak Serguei 2022-02-23 12:18:33 +03:00 committed by GitHub
parent b6572d1cab
commit c59115bb4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 5 deletions

View File

@ -9,7 +9,7 @@ from homeassistant.const import CONF_TOKEN, CONF_URL
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity import DeviceInfo, Entity
from .const import DOMAIN, PLATFORMS, ZWaveMePlatform
@ -104,9 +104,22 @@ class ZWaveMeEntity(Entity):
self.controller = controller
self.device = device
self._attr_name = device.title
self._attr_unique_id = f"{self.controller.config.unique_id}-{self.device.id}"
self._attr_unique_id: str = (
f"{self.controller.config.unique_id}-{self.device.id}"
)
self._attr_should_poll = False
@property
def device_info(self) -> DeviceInfo:
"""Return device specific attributes."""
return DeviceInfo(
identifiers={(DOMAIN, self._attr_unique_id)},
name=self._attr_name,
manufacturer=self.device.manufacturer,
sw_version=self.device.firmware,
suggested_area=self.device.locationName,
)
async def async_added_to_hass(self) -> None:
"""Connect to an updater."""
self.async_on_remove(

View File

@ -4,7 +4,7 @@
"documentation": "https://www.home-assistant.io/integrations/zwave_me",
"iot_class": "local_push",
"requirements": [
"zwave_me_ws==0.1.23",
"zwave_me_ws==0.2.1",
"url-normalize==1.4.1"
],
"after_dependencies": ["zeroconf"],

View File

@ -2569,4 +2569,4 @@ zm-py==0.5.2
zwave-js-server-python==0.35.1
# homeassistant.components.zwave_me
zwave_me_ws==0.1.23
zwave_me_ws==0.2.1

View File

@ -1594,4 +1594,4 @@ zigpy==0.43.0
zwave-js-server-python==0.35.1
# homeassistant.components.zwave_me
zwave_me_ws==0.1.23
zwave_me_ws==0.2.1