mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Update zwave-me-ws version to 0.3.6 (#90233)
This commit is contained in:
parent
9fecdddf01
commit
4b3c1f2800
@ -50,6 +50,8 @@ class ZWaveMeController:
|
|||||||
self.zwave_api = ZWaveMe(
|
self.zwave_api = ZWaveMe(
|
||||||
on_device_create=self.on_device_create,
|
on_device_create=self.on_device_create,
|
||||||
on_device_update=self.on_device_update,
|
on_device_update=self.on_device_update,
|
||||||
|
on_device_remove=self.on_device_unavailable,
|
||||||
|
on_device_destroy=self.on_device_destroy,
|
||||||
on_new_device=self.add_device,
|
on_new_device=self.add_device,
|
||||||
token=self.config.data[CONF_TOKEN],
|
token=self.config.data[CONF_TOKEN],
|
||||||
url=self.config.data[CONF_URL],
|
url=self.config.data[CONF_URL],
|
||||||
@ -82,6 +84,14 @@ class ZWaveMeController:
|
|||||||
"""Send signal to update device."""
|
"""Send signal to update device."""
|
||||||
dispatcher_send(self._hass, f"ZWAVE_ME_INFO_{new_info.id}", new_info)
|
dispatcher_send(self._hass, f"ZWAVE_ME_INFO_{new_info.id}", new_info)
|
||||||
|
|
||||||
|
def on_device_unavailable(self, device_id: str) -> None:
|
||||||
|
"""Send signal to set device unavailable."""
|
||||||
|
dispatcher_send(self._hass, f"ZWAVE_ME_UNAVAILABLE_{device_id}")
|
||||||
|
|
||||||
|
def on_device_destroy(self, device_id: str) -> None:
|
||||||
|
"""Send signal to destroy device."""
|
||||||
|
dispatcher_send(self._hass, f"ZWAVE_ME_DESTROY_{device_id}")
|
||||||
|
|
||||||
def remove_stale_devices(self, registry: dr.DeviceRegistry):
|
def remove_stale_devices(self, registry: dr.DeviceRegistry):
|
||||||
"""Remove old-format devices in the registry."""
|
"""Remove old-format devices in the registry."""
|
||||||
for device_id in self.device_ids:
|
for device_id in self.device_ids:
|
||||||
@ -133,10 +143,33 @@ class ZWaveMeEntity(Entity):
|
|||||||
self.hass, f"ZWAVE_ME_INFO_{self.device.id}", self.get_new_data
|
self.hass, f"ZWAVE_ME_INFO_{self.device.id}", self.get_new_data
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
self.async_on_remove(
|
||||||
|
async_dispatcher_connect(
|
||||||
|
self.hass,
|
||||||
|
f"ZWAVE_ME_UNAVAILABLE_{self.device.id}",
|
||||||
|
self.set_unavailable_status,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self.async_on_remove(
|
||||||
|
async_dispatcher_connect(
|
||||||
|
self.hass, f"ZWAVE_ME_DESTROY_{self.device.id}", self.delete_entity
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def get_new_data(self, new_data):
|
def get_new_data(self, new_data: ZWaveMeData) -> None:
|
||||||
"""Update info in the HAss."""
|
"""Update info in the HAss."""
|
||||||
self.device = new_data
|
self.device = new_data
|
||||||
self._attr_available = not new_data.isFailed
|
self._attr_available = not new_data.isFailed
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
|
@callback
|
||||||
|
def set_unavailable_status(self):
|
||||||
|
"""Update status in the HAss."""
|
||||||
|
self._attr_available = False
|
||||||
|
self.async_write_ha_state()
|
||||||
|
|
||||||
|
@callback
|
||||||
|
def delete_entity(self) -> None:
|
||||||
|
"""Remove this entity."""
|
||||||
|
self.hass.async_create_task(self.async_remove(force_remove=True))
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"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": ["zwave_me_ws==0.3.1", "url-normalize==1.4.3"],
|
"requirements": ["zwave_me_ws==0.3.6", "url-normalize==1.4.3"],
|
||||||
"zeroconf": [
|
"zeroconf": [
|
||||||
{
|
{
|
||||||
"type": "_hap._tcp.local.",
|
"type": "_hap._tcp.local.",
|
||||||
|
@ -2731,4 +2731,4 @@ zm-py==0.5.2
|
|||||||
zwave-js-server-python==0.47.0
|
zwave-js-server-python==0.47.0
|
||||||
|
|
||||||
# homeassistant.components.zwave_me
|
# homeassistant.components.zwave_me
|
||||||
zwave_me_ws==0.3.1
|
zwave_me_ws==0.3.6
|
||||||
|
@ -1956,4 +1956,4 @@ zigpy==0.53.2
|
|||||||
zwave-js-server-python==0.47.0
|
zwave-js-server-python==0.47.0
|
||||||
|
|
||||||
# homeassistant.components.zwave_me
|
# homeassistant.components.zwave_me
|
||||||
zwave_me_ws==0.3.1
|
zwave_me_ws==0.3.6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user