mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
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>
This commit is contained in:
parent
b6572d1cab
commit
c59115bb4f
@ -9,7 +9,7 @@ from homeassistant.const import CONF_TOKEN, CONF_URL
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
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
|
from .const import DOMAIN, PLATFORMS, ZWaveMePlatform
|
||||||
|
|
||||||
@ -104,9 +104,22 @@ class ZWaveMeEntity(Entity):
|
|||||||
self.controller = controller
|
self.controller = controller
|
||||||
self.device = device
|
self.device = device
|
||||||
self._attr_name = device.title
|
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
|
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:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Connect to an updater."""
|
"""Connect to an updater."""
|
||||||
self.async_on_remove(
|
self.async_on_remove(
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/zwave_me",
|
"documentation": "https://www.home-assistant.io/integrations/zwave_me",
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"zwave_me_ws==0.1.23",
|
"zwave_me_ws==0.2.1",
|
||||||
"url-normalize==1.4.1"
|
"url-normalize==1.4.1"
|
||||||
],
|
],
|
||||||
"after_dependencies": ["zeroconf"],
|
"after_dependencies": ["zeroconf"],
|
||||||
|
@ -2569,4 +2569,4 @@ zm-py==0.5.2
|
|||||||
zwave-js-server-python==0.35.1
|
zwave-js-server-python==0.35.1
|
||||||
|
|
||||||
# homeassistant.components.zwave_me
|
# homeassistant.components.zwave_me
|
||||||
zwave_me_ws==0.1.23
|
zwave_me_ws==0.2.1
|
||||||
|
@ -1594,4 +1594,4 @@ zigpy==0.43.0
|
|||||||
zwave-js-server-python==0.35.1
|
zwave-js-server-python==0.35.1
|
||||||
|
|
||||||
# homeassistant.components.zwave_me
|
# homeassistant.components.zwave_me
|
||||||
zwave_me_ws==0.1.23
|
zwave_me_ws==0.2.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user