Bump zwave-js-server-python to 0.35.3 (#70357)
This commit is contained in:
parent
80653463bf
commit
220cb57add
5 changed files with 35 additions and 14 deletions
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||
import asyncio
|
||||
from collections import defaultdict
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from async_timeout import timeout
|
||||
from zwave_js_server.client import Client as ZwaveClient
|
||||
|
@ -289,12 +290,7 @@ async def async_setup_entry( # noqa: C901
|
|||
)
|
||||
)
|
||||
# add listener for stateless node notification events
|
||||
entry.async_on_unload(
|
||||
node.on(
|
||||
"notification",
|
||||
lambda event: async_on_notification(event["notification"]),
|
||||
)
|
||||
)
|
||||
entry.async_on_unload(node.on("notification", async_on_notification))
|
||||
|
||||
async def async_on_node_added(node: ZwaveNode) -> None:
|
||||
"""Handle node added event."""
|
||||
|
@ -402,12 +398,14 @@ async def async_setup_entry( # noqa: C901
|
|||
)
|
||||
|
||||
@callback
|
||||
def async_on_notification(
|
||||
notification: EntryControlNotification
|
||||
| NotificationNotification
|
||||
| PowerLevelNotification,
|
||||
) -> None:
|
||||
def async_on_notification(event: dict[str, Any]) -> None:
|
||||
"""Relay stateless notification events from Z-Wave nodes to hass."""
|
||||
if "notification" not in event:
|
||||
LOGGER.info("Unknown notification: %s", event)
|
||||
return
|
||||
notification: EntryControlNotification | NotificationNotification | PowerLevelNotification = event[
|
||||
"notification"
|
||||
]
|
||||
device = dev_reg.async_get_device({get_device_id(client, notification.node)})
|
||||
# We assert because we know the device exists
|
||||
assert device
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Z-Wave JS",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/zwave_js",
|
||||
"requirements": ["zwave-js-server-python==0.35.2"],
|
||||
"requirements": ["zwave-js-server-python==0.35.3"],
|
||||
"codeowners": ["@home-assistant/z-wave"],
|
||||
"dependencies": ["usb", "http", "websocket_api"],
|
||||
"iot_class": "local_push",
|
||||
|
|
|
@ -2503,7 +2503,7 @@ zigpy==0.44.2
|
|||
zm-py==0.5.2
|
||||
|
||||
# homeassistant.components.zwave_js
|
||||
zwave-js-server-python==0.35.2
|
||||
zwave-js-server-python==0.35.3
|
||||
|
||||
# homeassistant.components.zwave_me
|
||||
zwave_me_ws==0.2.4
|
||||
|
|
|
@ -1625,7 +1625,7 @@ zigpy-znp==0.7.0
|
|||
zigpy==0.44.2
|
||||
|
||||
# homeassistant.components.zwave_js
|
||||
zwave-js-server-python==0.35.2
|
||||
zwave-js-server-python==0.35.3
|
||||
|
||||
# homeassistant.components.zwave_me
|
||||
zwave_me_ws==0.2.4
|
||||
|
|
|
@ -307,3 +307,26 @@ async def test_unknown_notification(hass, hank_binary_switch, integration, clien
|
|||
notification_obj.node = node
|
||||
with pytest.raises(TypeError):
|
||||
node.emit("notification", {"notification": notification_obj})
|
||||
|
||||
notification_events = async_capture_events(hass, "zwave_js_notification")
|
||||
|
||||
# Test a valid notification with an unsupported command class
|
||||
event = Event(
|
||||
type="notification",
|
||||
data={
|
||||
"source": "node",
|
||||
"event": "notification",
|
||||
"nodeId": node.node_id,
|
||||
"ccId": 0,
|
||||
"args": {
|
||||
"commandClassName": "No Operation",
|
||||
"commandClass": 0,
|
||||
"testNodeId": 1,
|
||||
"status": 0,
|
||||
"acknowledgedFrames": 2,
|
||||
},
|
||||
},
|
||||
)
|
||||
node.receive_event(event)
|
||||
|
||||
assert not notification_events
|
||||
|
|
Loading…
Add table
Reference in a new issue