Skip to content

Commit 220cb57

Browse files
authored
Bump zwave-js-server-python to 0.35.3 (home-assistant#70357)
1 parent 8065346 commit 220cb57

File tree

5 files changed

+35
-14
lines changed

5 files changed

+35
-14
lines changed

homeassistant/components/zwave_js/__init__.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import asyncio
55
from collections import defaultdict
66
from collections.abc import Callable
7+
from typing import Any
78

89
from async_timeout import timeout
910
from zwave_js_server.client import Client as ZwaveClient
@@ -289,12 +290,7 @@ async def async_on_node_ready(node: ZwaveNode) -> None:
289290
)
290291
)
291292
# add listener for stateless node notification events
292-
entry.async_on_unload(
293-
node.on(
294-
"notification",
295-
lambda event: async_on_notification(event["notification"]),
296-
)
297-
)
293+
entry.async_on_unload(node.on("notification", async_on_notification))
298294

299295
async def async_on_node_added(node: ZwaveNode) -> None:
300296
"""Handle node added event."""
@@ -402,12 +398,14 @@ def async_on_value_notification(notification: ValueNotification) -> None:
402398
)
403399

404400
@callback
405-
def async_on_notification(
406-
notification: EntryControlNotification
407-
| NotificationNotification
408-
| PowerLevelNotification,
409-
) -> None:
401+
def async_on_notification(event: dict[str, Any]) -> None:
410402
"""Relay stateless notification events from Z-Wave nodes to hass."""
403+
if "notification" not in event:
404+
LOGGER.info("Unknown notification: %s", event)
405+
return
406+
notification: EntryControlNotification | NotificationNotification | PowerLevelNotification = event[
407+
"notification"
408+
]
411409
device = dev_reg.async_get_device({get_device_id(client, notification.node)})
412410
# We assert because we know the device exists
413411
assert device

homeassistant/components/zwave_js/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Z-Wave JS",
44
"config_flow": true,
55
"documentation": "https://www.home-assistant.io/integrations/zwave_js",
6-
"requirements": ["zwave-js-server-python==0.35.2"],
6+
"requirements": ["zwave-js-server-python==0.35.3"],
77
"codeowners": ["@home-assistant/z-wave"],
88
"dependencies": ["usb", "http", "websocket_api"],
99
"iot_class": "local_push",

requirements_all.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2503,7 +2503,7 @@ zigpy==0.44.2
25032503
zm-py==0.5.2
25042504

25052505
# homeassistant.components.zwave_js
2506-
zwave-js-server-python==0.35.2
2506+
zwave-js-server-python==0.35.3
25072507

25082508
# homeassistant.components.zwave_me
25092509
zwave_me_ws==0.2.4

requirements_test_all.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ zigpy-znp==0.7.0
16251625
zigpy==0.44.2
16261626

16271627
# homeassistant.components.zwave_js
1628-
zwave-js-server-python==0.35.2
1628+
zwave-js-server-python==0.35.3
16291629

16301630
# homeassistant.components.zwave_me
16311631
zwave_me_ws==0.2.4

tests/components/zwave_js/test_events.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,26 @@ async def test_unknown_notification(hass, hank_binary_switch, integration, clien
307307
notification_obj.node = node
308308
with pytest.raises(TypeError):
309309
node.emit("notification", {"notification": notification_obj})
310+
311+
notification_events = async_capture_events(hass, "zwave_js_notification")
312+
313+
# Test a valid notification with an unsupported command class
314+
event = Event(
315+
type="notification",
316+
data={
317+
"source": "node",
318+
"event": "notification",
319+
"nodeId": node.node_id,
320+
"ccId": 0,
321+
"args": {
322+
"commandClassName": "No Operation",
323+
"commandClass": 0,
324+
"testNodeId": 1,
325+
"status": 0,
326+
"acknowledgedFrames": 2,
327+
},
328+
},
329+
)
330+
node.receive_event(event)
331+
332+
assert not notification_events

0 commit comments

Comments
 (0)