Bump zwave-js-server-python to 0.23.0 to support zwave-js 7 (#48094)
* Bump zwave-js-server-python to 0.23.0 and update integration to support schema changes * refactor notification evenets a bit * fix tests and bug fixes * additional changes due to new PR * add command class and command name * use new event names so we can retain event property names * handle command status being returned from async_set_config_parameter * bump dependency version * adjust log message to be consistent * disable pylint warning * Update homeassistant/components/zwave_js/services.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * add test for awake node * switch async_get_registry to async_get Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
cf6352e93c
commit
dda9f957b6
12 changed files with 175 additions and 61 deletions
|
@ -1,4 +1,5 @@
|
|||
"""Test Z-Wave JS (value notification) events."""
|
||||
from zwave_js_server.const import CommandClass
|
||||
from zwave_js_server.event import Event
|
||||
|
||||
from tests.common import async_capture_events
|
||||
|
@ -8,7 +9,7 @@ async def test_scenes(hass, hank_binary_switch, integration, client):
|
|||
"""Test scene events."""
|
||||
# just pick a random node to fake the value notification events
|
||||
node = hank_binary_switch
|
||||
events = async_capture_events(hass, "zwave_js_event")
|
||||
events = async_capture_events(hass, "zwave_js_value_notification")
|
||||
|
||||
# Publish fake Basic Set value notification
|
||||
event = Event(
|
||||
|
@ -137,25 +138,59 @@ async def test_notifications(hass, hank_binary_switch, integration, client):
|
|||
"""Test notification events."""
|
||||
# just pick a random node to fake the value notification events
|
||||
node = hank_binary_switch
|
||||
events = async_capture_events(hass, "zwave_js_event")
|
||||
events = async_capture_events(hass, "zwave_js_notification")
|
||||
|
||||
# Publish fake Basic Set value notification
|
||||
# Publish fake Notification CC notification
|
||||
event = Event(
|
||||
type="notification",
|
||||
data={
|
||||
"source": "node",
|
||||
"event": "notification",
|
||||
"nodeId": 23,
|
||||
"notificationLabel": "Keypad lock operation",
|
||||
"parameters": {"userId": 1},
|
||||
"nodeId": 32,
|
||||
"ccId": 113,
|
||||
"args": {
|
||||
"type": 6,
|
||||
"event": 5,
|
||||
"label": "Access Control",
|
||||
"eventLabel": "Keypad lock operation",
|
||||
"parameters": {"userId": 1},
|
||||
},
|
||||
},
|
||||
)
|
||||
node.receive_event(event)
|
||||
# wait for the event
|
||||
await hass.async_block_till_done()
|
||||
assert len(events) == 1
|
||||
assert events[0].data["type"] == "notification"
|
||||
assert events[0].data["home_id"] == client.driver.controller.home_id
|
||||
assert events[0].data["node_id"] == 32
|
||||
assert events[0].data["label"] == "Keypad lock operation"
|
||||
assert events[0].data["type"] == 6
|
||||
assert events[0].data["event"] == 5
|
||||
assert events[0].data["label"] == "Access Control"
|
||||
assert events[0].data["event_label"] == "Keypad lock operation"
|
||||
assert events[0].data["parameters"]["userId"] == 1
|
||||
assert events[0].data["command_class"] == CommandClass.NOTIFICATION
|
||||
assert events[0].data["command_class_name"] == "Notification"
|
||||
|
||||
# Publish fake Entry Control CC notification
|
||||
event = Event(
|
||||
type="notification",
|
||||
data={
|
||||
"source": "node",
|
||||
"event": "notification",
|
||||
"nodeId": 32,
|
||||
"ccId": 111,
|
||||
"args": {"eventType": 5, "dataType": 2, "eventData": "555"},
|
||||
},
|
||||
)
|
||||
|
||||
node.receive_event(event)
|
||||
# wait for the event
|
||||
await hass.async_block_till_done()
|
||||
assert len(events) == 2
|
||||
assert events[1].data["home_id"] == client.driver.controller.home_id
|
||||
assert events[1].data["node_id"] == 32
|
||||
assert events[1].data["event_type"] == 5
|
||||
assert events[1].data["data_type"] == 2
|
||||
assert events[1].data["event_data"] == "555"
|
||||
assert events[1].data["command_class"] == CommandClass.ENTRY_CONTROL
|
||||
assert events[1].data["command_class_name"] == "Entry Control"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue