Add new zwave_js notification parameters (#75796)

This commit is contained in:
Raman Gupta 2022-07-27 17:40:44 -04:00 committed by GitHub
parent b0c17d67df
commit 44f1d92890
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 3 deletions

View file

@ -43,12 +43,14 @@ from .const import (
ATTR_COMMAND_CLASS,
ATTR_COMMAND_CLASS_NAME,
ATTR_DATA_TYPE,
ATTR_DATA_TYPE_LABEL,
ATTR_DIRECTION,
ATTR_ENDPOINT,
ATTR_EVENT,
ATTR_EVENT_DATA,
ATTR_EVENT_LABEL,
ATTR_EVENT_TYPE,
ATTR_EVENT_TYPE_LABEL,
ATTR_HOME_ID,
ATTR_LABEL,
ATTR_NODE_ID,
@ -476,7 +478,9 @@ async def setup_driver( # noqa: C901
{
ATTR_COMMAND_CLASS_NAME: "Entry Control",
ATTR_EVENT_TYPE: notification.event_type,
ATTR_EVENT_TYPE_LABEL: notification.event_type_label,
ATTR_DATA_TYPE: notification.data_type,
ATTR_DATA_TYPE_LABEL: notification.data_type_label,
ATTR_EVENT_DATA: notification.event_data,
}
)
@ -505,6 +509,7 @@ async def setup_driver( # noqa: C901
{
ATTR_COMMAND_CLASS_NAME: "Multilevel Switch",
ATTR_EVENT_TYPE: notification.event_type,
ATTR_EVENT_TYPE_LABEL: notification.event_type_label,
ATTR_DIRECTION: notification.direction,
}
)

View file

@ -56,6 +56,8 @@ ATTR_OPTIONS = "options"
ATTR_TEST_NODE_ID = "test_node_id"
ATTR_STATUS = "status"
ATTR_ACKNOWLEDGED_FRAMES = "acknowledged_frames"
ATTR_EVENT_TYPE_LABEL = "event_type_label"
ATTR_DATA_TYPE_LABEL = "data_type_label"
ATTR_NODE = "node"
ATTR_ZWAVE_VALUE = "zwave_value"

View file

@ -252,7 +252,13 @@ async def test_if_entry_control_notification_fires(
"event": "notification",
"nodeId": node.node_id,
"ccId": 111,
"args": {"eventType": 5, "dataType": 2, "eventData": "555"},
"args": {
"eventType": 5,
"eventTypeLabel": "label 1",
"dataType": 2,
"dataTypeLabel": "label 2",
"eventData": "555",
},
},
)
node.receive_event(event)

View file

@ -182,7 +182,13 @@ async def test_notifications(hass, hank_binary_switch, integration, client):
"event": "notification",
"nodeId": 32,
"ccId": 111,
"args": {"eventType": 5, "dataType": 2, "eventData": "555"},
"args": {
"eventType": 5,
"eventTypeLabel": "test1",
"dataType": 2,
"dataTypeLabel": "test2",
"eventData": "555",
},
},
)
@ -193,7 +199,9 @@ async def test_notifications(hass, hank_binary_switch, integration, client):
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["event_type_label"] == "test1"
assert events[1].data["data_type"] == 2
assert events[1].data["data_type_label"] == "test2"
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"
@ -206,7 +214,7 @@ async def test_notifications(hass, hank_binary_switch, integration, client):
"event": "notification",
"nodeId": 32,
"ccId": 38,
"args": {"eventType": 4, "direction": "up"},
"args": {"eventType": 4, "eventTypeLabel": "test1", "direction": "up"},
},
)
@ -217,6 +225,7 @@ async def test_notifications(hass, hank_binary_switch, integration, client):
assert events[2].data["home_id"] == client.driver.controller.home_id
assert events[2].data["node_id"] == 32
assert events[2].data["event_type"] == 4
assert events[2].data["event_type_label"] == "test1"
assert events[2].data["direction"] == "up"
assert events[2].data["command_class"] == CommandClass.SWITCH_MULTILEVEL
assert events[2].data["command_class_name"] == "Multilevel Switch"