Bump zwave-js-server-python to 0.52.0 (#100833)
* Bump zwave-js-server-python to 0.52.0 * remove old function * fix tests
This commit is contained in:
parent
59a26010ba
commit
176f5dc2d6
10 changed files with 169 additions and 100 deletions
|
@ -411,15 +411,15 @@ def async_register_api(hass: HomeAssistant) -> None:
|
|||
websocket_api.async_register_command(hass, websocket_remove_node)
|
||||
websocket_api.async_register_command(hass, websocket_remove_failed_node)
|
||||
websocket_api.async_register_command(hass, websocket_replace_failed_node)
|
||||
websocket_api.async_register_command(hass, websocket_begin_healing_network)
|
||||
websocket_api.async_register_command(hass, websocket_begin_rebuilding_routes)
|
||||
websocket_api.async_register_command(
|
||||
hass, websocket_subscribe_heal_network_progress
|
||||
hass, websocket_subscribe_rebuild_routes_progress
|
||||
)
|
||||
websocket_api.async_register_command(hass, websocket_stop_healing_network)
|
||||
websocket_api.async_register_command(hass, websocket_stop_rebuilding_routes)
|
||||
websocket_api.async_register_command(hass, websocket_refresh_node_info)
|
||||
websocket_api.async_register_command(hass, websocket_refresh_node_values)
|
||||
websocket_api.async_register_command(hass, websocket_refresh_node_cc_values)
|
||||
websocket_api.async_register_command(hass, websocket_heal_node)
|
||||
websocket_api.async_register_command(hass, websocket_rebuild_node_routes)
|
||||
websocket_api.async_register_command(hass, websocket_set_config_parameter)
|
||||
websocket_api.async_register_command(hass, websocket_get_config_parameters)
|
||||
websocket_api.async_register_command(hass, websocket_subscribe_log_updates)
|
||||
|
@ -511,7 +511,7 @@ async def websocket_network_status(
|
|||
"supported_function_types": controller.supported_function_types,
|
||||
"suc_node_id": controller.suc_node_id,
|
||||
"supports_timers": controller.supports_timers,
|
||||
"is_heal_network_active": controller.is_heal_network_active,
|
||||
"is_rebuilding_routes": controller.is_rebuilding_routes,
|
||||
"inclusion_state": controller.inclusion_state,
|
||||
"rf_region": controller.rf_region,
|
||||
"status": controller.status,
|
||||
|
@ -1379,14 +1379,14 @@ async def websocket_remove_failed_node(
|
|||
@websocket_api.require_admin
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required(TYPE): "zwave_js/begin_healing_network",
|
||||
vol.Required(TYPE): "zwave_js/begin_rebuilding_routes",
|
||||
vol.Required(ENTRY_ID): str,
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@async_handle_failed_command
|
||||
@async_get_entry
|
||||
async def websocket_begin_healing_network(
|
||||
async def websocket_begin_rebuilding_routes(
|
||||
hass: HomeAssistant,
|
||||
connection: ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
|
@ -1394,10 +1394,10 @@ async def websocket_begin_healing_network(
|
|||
client: Client,
|
||||
driver: Driver,
|
||||
) -> None:
|
||||
"""Begin healing the Z-Wave network."""
|
||||
"""Begin rebuilding Z-Wave routes."""
|
||||
controller = driver.controller
|
||||
|
||||
result = await controller.async_begin_healing_network()
|
||||
result = await controller.async_begin_rebuilding_routes()
|
||||
connection.send_result(
|
||||
msg[ID],
|
||||
result,
|
||||
|
@ -1407,13 +1407,13 @@ async def websocket_begin_healing_network(
|
|||
@websocket_api.require_admin
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required(TYPE): "zwave_js/subscribe_heal_network_progress",
|
||||
vol.Required(TYPE): "zwave_js/subscribe_rebuild_routes_progress",
|
||||
vol.Required(ENTRY_ID): str,
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@async_get_entry
|
||||
async def websocket_subscribe_heal_network_progress(
|
||||
async def websocket_subscribe_rebuild_routes_progress(
|
||||
hass: HomeAssistant,
|
||||
connection: ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
|
@ -1421,7 +1421,7 @@ async def websocket_subscribe_heal_network_progress(
|
|||
client: Client,
|
||||
driver: Driver,
|
||||
) -> None:
|
||||
"""Subscribe to heal Z-Wave network status updates."""
|
||||
"""Subscribe to rebuild Z-Wave routes status updates."""
|
||||
controller = driver.controller
|
||||
|
||||
@callback
|
||||
|
@ -1434,30 +1434,39 @@ async def websocket_subscribe_heal_network_progress(
|
|||
def forward_event(key: str, event: dict) -> None:
|
||||
connection.send_message(
|
||||
websocket_api.event_message(
|
||||
msg[ID], {"event": event["event"], "heal_node_status": event[key]}
|
||||
msg[ID], {"event": event["event"], "rebuild_routes_status": event[key]}
|
||||
)
|
||||
)
|
||||
|
||||
connection.subscriptions[msg["id"]] = async_cleanup
|
||||
msg[DATA_UNSUBSCRIBE] = unsubs = [
|
||||
controller.on("heal network progress", partial(forward_event, "progress")),
|
||||
controller.on("heal network done", partial(forward_event, "result")),
|
||||
controller.on("rebuild routes progress", partial(forward_event, "progress")),
|
||||
controller.on("rebuild routes done", partial(forward_event, "result")),
|
||||
]
|
||||
|
||||
connection.send_result(msg[ID], controller.heal_network_progress)
|
||||
if controller.rebuild_routes_progress:
|
||||
connection.send_result(
|
||||
msg[ID],
|
||||
{
|
||||
node.node_id: status
|
||||
for node, status in controller.rebuild_routes_progress.items()
|
||||
},
|
||||
)
|
||||
else:
|
||||
connection.send_result(msg[ID], None)
|
||||
|
||||
|
||||
@websocket_api.require_admin
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required(TYPE): "zwave_js/stop_healing_network",
|
||||
vol.Required(TYPE): "zwave_js/stop_rebuilding_routes",
|
||||
vol.Required(ENTRY_ID): str,
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@async_handle_failed_command
|
||||
@async_get_entry
|
||||
async def websocket_stop_healing_network(
|
||||
async def websocket_stop_rebuilding_routes(
|
||||
hass: HomeAssistant,
|
||||
connection: ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
|
@ -1465,9 +1474,9 @@ async def websocket_stop_healing_network(
|
|||
client: Client,
|
||||
driver: Driver,
|
||||
) -> None:
|
||||
"""Stop healing the Z-Wave network."""
|
||||
"""Stop rebuilding Z-Wave routes."""
|
||||
controller = driver.controller
|
||||
result = await controller.async_stop_healing_network()
|
||||
result = await controller.async_stop_rebuilding_routes()
|
||||
connection.send_result(
|
||||
msg[ID],
|
||||
result,
|
||||
|
@ -1477,14 +1486,14 @@ async def websocket_stop_healing_network(
|
|||
@websocket_api.require_admin
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required(TYPE): "zwave_js/heal_node",
|
||||
vol.Required(TYPE): "zwave_js/rebuild_node_routes",
|
||||
vol.Required(DEVICE_ID): str,
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@async_handle_failed_command
|
||||
@async_get_node
|
||||
async def websocket_heal_node(
|
||||
async def websocket_rebuild_node_routes(
|
||||
hass: HomeAssistant,
|
||||
connection: ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
|
@ -1495,7 +1504,7 @@ async def websocket_heal_node(
|
|||
assert driver is not None # The node comes from the driver instance.
|
||||
controller = driver.controller
|
||||
|
||||
result = await controller.async_heal_node(node)
|
||||
result = await controller.async_rebuild_node_routes(node)
|
||||
connection.send_result(
|
||||
msg[ID],
|
||||
result,
|
||||
|
|
|
@ -125,7 +125,6 @@ def get_value_of_zwave_value(value: ZwaveValue | None) -> Any | None:
|
|||
async def async_enable_statistics(driver: Driver) -> None:
|
||||
"""Enable statistics on the driver."""
|
||||
await driver.async_enable_statistics("Home Assistant", HA_VERSION)
|
||||
await driver.async_enable_error_reporting()
|
||||
|
||||
|
||||
@callback
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"iot_class": "local_push",
|
||||
"loggers": ["zwave_js_server"],
|
||||
"quality_scale": "platinum",
|
||||
"requirements": ["pyserial==3.5", "zwave-js-server-python==0.51.3"],
|
||||
"requirements": ["pyserial==3.5", "zwave-js-server-python==0.52.0"],
|
||||
"usb": [
|
||||
{
|
||||
"vid": "0658",
|
||||
|
|
|
@ -62,7 +62,12 @@ class ZWaveNodeFirmwareUpdateExtraStoredData(ExtraStoredData):
|
|||
@classmethod
|
||||
def from_dict(cls, data: dict[str, Any]) -> ZWaveNodeFirmwareUpdateExtraStoredData:
|
||||
"""Initialize the extra data from a dict."""
|
||||
if not (firmware_dict := data[ATTR_LATEST_VERSION_FIRMWARE]):
|
||||
# If there was no firmware info stored, or if it's stale info, we don't restore
|
||||
# anything.
|
||||
if (
|
||||
not (firmware_dict := data[ATTR_LATEST_VERSION_FIRMWARE])
|
||||
or "normalizedVersion" not in firmware_dict
|
||||
):
|
||||
return cls(None)
|
||||
|
||||
return cls(NodeFirmwareUpdateInfo.from_dict(firmware_dict))
|
||||
|
@ -267,9 +272,7 @@ class ZWaveNodeFirmwareUpdate(UpdateEntity):
|
|||
)
|
||||
|
||||
try:
|
||||
await self.driver.controller.async_firmware_update_ota(
|
||||
self.node, firmware.files
|
||||
)
|
||||
await self.driver.controller.async_firmware_update_ota(self.node, firmware)
|
||||
except BaseZwaveJSServerError as err:
|
||||
self._unsub_firmware_events_and_reset_progress()
|
||||
raise HomeAssistantError(err) from err
|
||||
|
|
|
@ -2811,7 +2811,7 @@ zigpy==0.57.1
|
|||
zm-py==0.5.2
|
||||
|
||||
# homeassistant.components.zwave_js
|
||||
zwave-js-server-python==0.51.3
|
||||
zwave-js-server-python==0.52.0
|
||||
|
||||
# homeassistant.components.zwave_me
|
||||
zwave-me-ws==0.4.3
|
||||
|
|
|
@ -2096,7 +2096,7 @@ zigpy-znp==0.11.4
|
|||
zigpy==0.57.1
|
||||
|
||||
# homeassistant.components.zwave_js
|
||||
zwave-js-server-python==0.51.3
|
||||
zwave-js-server-python==0.52.0
|
||||
|
||||
# homeassistant.components.zwave_me
|
||||
zwave-me-ws==0.4.3
|
||||
|
|
|
@ -906,7 +906,7 @@ async def test_add_node(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -1179,7 +1179,7 @@ async def test_provision_smart_start_node(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -1283,7 +1283,7 @@ async def test_unprovision_smart_start_node(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -1355,7 +1355,7 @@ async def test_get_provisioning_entries(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -1450,7 +1450,7 @@ async def test_parse_qr_code_string(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -1517,7 +1517,7 @@ async def test_try_parse_dsk_from_qr_code_string(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -1599,7 +1599,7 @@ async def test_cancel_inclusion_exclusion(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test FailedZWaveCommand is caught
|
||||
with patch(
|
||||
|
@ -1617,7 +1617,7 @@ async def test_cancel_inclusion_exclusion(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -1736,7 +1736,7 @@ async def test_remove_node(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -2081,7 +2081,7 @@ async def test_replace_failed_node(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -2132,7 +2132,7 @@ async def test_remove_failed_node(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
await ws_client.send_json(
|
||||
{
|
||||
|
@ -2187,13 +2187,13 @@ async def test_remove_failed_node(
|
|||
assert msg["error"]["code"] == ERR_NOT_LOADED
|
||||
|
||||
|
||||
async def test_begin_healing_network(
|
||||
async def test_begin_rebuilding_routes(
|
||||
hass: HomeAssistant,
|
||||
integration,
|
||||
client,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
) -> None:
|
||||
"""Test the begin_healing_network websocket command."""
|
||||
"""Test the begin_rebuilding_routes websocket command."""
|
||||
entry = integration
|
||||
ws_client = await hass_ws_client(hass)
|
||||
|
||||
|
@ -2202,7 +2202,7 @@ async def test_begin_healing_network(
|
|||
await ws_client.send_json(
|
||||
{
|
||||
ID: 3,
|
||||
TYPE: "zwave_js/begin_healing_network",
|
||||
TYPE: "zwave_js/begin_rebuilding_routes",
|
||||
ENTRY_ID: entry.entry_id,
|
||||
}
|
||||
)
|
||||
|
@ -2213,13 +2213,13 @@ async def test_begin_healing_network(
|
|||
|
||||
# Test FailedZWaveCommand is caught
|
||||
with patch(
|
||||
f"{CONTROLLER_PATCH_PREFIX}.async_begin_healing_network",
|
||||
f"{CONTROLLER_PATCH_PREFIX}.async_begin_rebuilding_routes",
|
||||
side_effect=FailedZWaveCommand("failed_command", 1, "error message"),
|
||||
):
|
||||
await ws_client.send_json(
|
||||
{
|
||||
ID: 4,
|
||||
TYPE: "zwave_js/begin_healing_network",
|
||||
TYPE: "zwave_js/begin_rebuilding_routes",
|
||||
ENTRY_ID: entry.entry_id,
|
||||
}
|
||||
)
|
||||
|
@ -2227,7 +2227,7 @@ async def test_begin_healing_network(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -2236,7 +2236,7 @@ async def test_begin_healing_network(
|
|||
await ws_client.send_json(
|
||||
{
|
||||
ID: 5,
|
||||
TYPE: "zwave_js/begin_healing_network",
|
||||
TYPE: "zwave_js/begin_rebuilding_routes",
|
||||
ENTRY_ID: entry.entry_id,
|
||||
}
|
||||
)
|
||||
|
@ -2246,17 +2246,21 @@ async def test_begin_healing_network(
|
|||
assert msg["error"]["code"] == ERR_NOT_LOADED
|
||||
|
||||
|
||||
async def test_subscribe_heal_network_progress(
|
||||
hass: HomeAssistant, integration, client, hass_ws_client: WebSocketGenerator
|
||||
async def test_subscribe_rebuild_routes_progress(
|
||||
hass: HomeAssistant,
|
||||
integration,
|
||||
client,
|
||||
nortek_thermostat,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
) -> None:
|
||||
"""Test the subscribe_heal_network_progress command."""
|
||||
"""Test the subscribe_rebuild_routes_progress command."""
|
||||
entry = integration
|
||||
ws_client = await hass_ws_client(hass)
|
||||
|
||||
await ws_client.send_json(
|
||||
{
|
||||
ID: 3,
|
||||
TYPE: "zwave_js/subscribe_heal_network_progress",
|
||||
TYPE: "zwave_js/subscribe_rebuild_routes_progress",
|
||||
ENTRY_ID: entry.entry_id,
|
||||
}
|
||||
)
|
||||
|
@ -2265,19 +2269,19 @@ async def test_subscribe_heal_network_progress(
|
|||
assert msg["success"]
|
||||
assert msg["result"] is None
|
||||
|
||||
# Fire heal network progress
|
||||
# Fire rebuild routes progress
|
||||
event = Event(
|
||||
"heal network progress",
|
||||
"rebuild routes progress",
|
||||
{
|
||||
"source": "controller",
|
||||
"event": "heal network progress",
|
||||
"event": "rebuild routes progress",
|
||||
"progress": {67: "pending"},
|
||||
},
|
||||
)
|
||||
client.driver.controller.receive_event(event)
|
||||
msg = await ws_client.receive_json()
|
||||
assert msg["event"]["event"] == "heal network progress"
|
||||
assert msg["event"]["heal_node_status"] == {"67": "pending"}
|
||||
assert msg["event"]["event"] == "rebuild routes progress"
|
||||
assert msg["event"]["rebuild_routes_status"] == {"67": "pending"}
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -2286,7 +2290,7 @@ async def test_subscribe_heal_network_progress(
|
|||
await ws_client.send_json(
|
||||
{
|
||||
ID: 4,
|
||||
TYPE: "zwave_js/subscribe_heal_network_progress",
|
||||
TYPE: "zwave_js/subscribe_rebuild_routes_progress",
|
||||
ENTRY_ID: entry.entry_id,
|
||||
}
|
||||
)
|
||||
|
@ -2296,21 +2300,25 @@ async def test_subscribe_heal_network_progress(
|
|||
assert msg["error"]["code"] == ERR_NOT_LOADED
|
||||
|
||||
|
||||
async def test_subscribe_heal_network_progress_initial_value(
|
||||
hass: HomeAssistant, integration, client, hass_ws_client: WebSocketGenerator
|
||||
async def test_subscribe_rebuild_routes_progress_initial_value(
|
||||
hass: HomeAssistant,
|
||||
integration,
|
||||
client,
|
||||
nortek_thermostat,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
) -> None:
|
||||
"""Test subscribe_heal_network_progress command when heal network in progress."""
|
||||
"""Test subscribe_rebuild_routes_progress command when rebuild routes in progress."""
|
||||
entry = integration
|
||||
ws_client = await hass_ws_client(hass)
|
||||
|
||||
assert not client.driver.controller.heal_network_progress
|
||||
assert not client.driver.controller.rebuild_routes_progress
|
||||
|
||||
# Fire heal network progress before sending heal network progress command
|
||||
# Fire rebuild routes progress before sending rebuild routes progress command
|
||||
event = Event(
|
||||
"heal network progress",
|
||||
"rebuild routes progress",
|
||||
{
|
||||
"source": "controller",
|
||||
"event": "heal network progress",
|
||||
"event": "rebuild routes progress",
|
||||
"progress": {67: "pending"},
|
||||
},
|
||||
)
|
||||
|
@ -2319,7 +2327,7 @@ async def test_subscribe_heal_network_progress_initial_value(
|
|||
await ws_client.send_json(
|
||||
{
|
||||
ID: 3,
|
||||
TYPE: "zwave_js/subscribe_heal_network_progress",
|
||||
TYPE: "zwave_js/subscribe_rebuild_routes_progress",
|
||||
ENTRY_ID: entry.entry_id,
|
||||
}
|
||||
)
|
||||
|
@ -2329,13 +2337,13 @@ async def test_subscribe_heal_network_progress_initial_value(
|
|||
assert msg["result"] == {"67": "pending"}
|
||||
|
||||
|
||||
async def test_stop_healing_network(
|
||||
async def test_stop_rebuilding_routes(
|
||||
hass: HomeAssistant,
|
||||
integration,
|
||||
client,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
) -> None:
|
||||
"""Test the stop_healing_network websocket command."""
|
||||
"""Test the stop_rebuilding_routes websocket command."""
|
||||
entry = integration
|
||||
ws_client = await hass_ws_client(hass)
|
||||
|
||||
|
@ -2344,7 +2352,7 @@ async def test_stop_healing_network(
|
|||
await ws_client.send_json(
|
||||
{
|
||||
ID: 3,
|
||||
TYPE: "zwave_js/stop_healing_network",
|
||||
TYPE: "zwave_js/stop_rebuilding_routes",
|
||||
ENTRY_ID: entry.entry_id,
|
||||
}
|
||||
)
|
||||
|
@ -2355,13 +2363,13 @@ async def test_stop_healing_network(
|
|||
|
||||
# Test FailedZWaveCommand is caught
|
||||
with patch(
|
||||
f"{CONTROLLER_PATCH_PREFIX}.async_stop_healing_network",
|
||||
f"{CONTROLLER_PATCH_PREFIX}.async_stop_rebuilding_routes",
|
||||
side_effect=FailedZWaveCommand("failed_command", 1, "error message"),
|
||||
):
|
||||
await ws_client.send_json(
|
||||
{
|
||||
ID: 4,
|
||||
TYPE: "zwave_js/stop_healing_network",
|
||||
TYPE: "zwave_js/stop_rebuilding_routes",
|
||||
ENTRY_ID: entry.entry_id,
|
||||
}
|
||||
)
|
||||
|
@ -2369,7 +2377,7 @@ async def test_stop_healing_network(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -2378,7 +2386,7 @@ async def test_stop_healing_network(
|
|||
await ws_client.send_json(
|
||||
{
|
||||
ID: 5,
|
||||
TYPE: "zwave_js/stop_healing_network",
|
||||
TYPE: "zwave_js/stop_rebuilding_routes",
|
||||
ENTRY_ID: entry.entry_id,
|
||||
}
|
||||
)
|
||||
|
@ -2388,14 +2396,14 @@ async def test_stop_healing_network(
|
|||
assert msg["error"]["code"] == ERR_NOT_LOADED
|
||||
|
||||
|
||||
async def test_heal_node(
|
||||
async def test_rebuild_node_routes(
|
||||
hass: HomeAssistant,
|
||||
multisensor_6,
|
||||
integration,
|
||||
client,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
) -> None:
|
||||
"""Test the heal_node websocket command."""
|
||||
"""Test the rebuild_node_routes websocket command."""
|
||||
entry = integration
|
||||
ws_client = await hass_ws_client(hass)
|
||||
device = get_device(hass, multisensor_6)
|
||||
|
@ -2405,7 +2413,7 @@ async def test_heal_node(
|
|||
await ws_client.send_json(
|
||||
{
|
||||
ID: 3,
|
||||
TYPE: "zwave_js/heal_node",
|
||||
TYPE: "zwave_js/rebuild_node_routes",
|
||||
DEVICE_ID: device.id,
|
||||
}
|
||||
)
|
||||
|
@ -2416,13 +2424,13 @@ async def test_heal_node(
|
|||
|
||||
# Test FailedZWaveCommand is caught
|
||||
with patch(
|
||||
f"{CONTROLLER_PATCH_PREFIX}.async_heal_node",
|
||||
f"{CONTROLLER_PATCH_PREFIX}.async_rebuild_node_routes",
|
||||
side_effect=FailedZWaveCommand("failed_command", 1, "error message"),
|
||||
):
|
||||
await ws_client.send_json(
|
||||
{
|
||||
ID: 4,
|
||||
TYPE: "zwave_js/heal_node",
|
||||
TYPE: "zwave_js/rebuild_node_routes",
|
||||
DEVICE_ID: device.id,
|
||||
}
|
||||
)
|
||||
|
@ -2430,7 +2438,7 @@ async def test_heal_node(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -2439,7 +2447,7 @@ async def test_heal_node(
|
|||
await ws_client.send_json(
|
||||
{
|
||||
ID: 5,
|
||||
TYPE: "zwave_js/heal_node",
|
||||
TYPE: "zwave_js/rebuild_node_routes",
|
||||
DEVICE_ID: device.id,
|
||||
}
|
||||
)
|
||||
|
@ -2558,7 +2566,7 @@ async def test_refresh_node_info(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -2635,7 +2643,7 @@ async def test_refresh_node_values(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -2729,7 +2737,7 @@ async def test_refresh_node_cc_values(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -2954,7 +2962,7 @@ async def test_set_config_parameter(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -3312,7 +3320,7 @@ async def test_subscribe_log_updates(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -3465,7 +3473,7 @@ async def test_update_log_config(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -3569,13 +3577,10 @@ async def test_data_collection(
|
|||
result = msg["result"]
|
||||
assert result is None
|
||||
|
||||
assert len(client.async_send_command.call_args_list) == 2
|
||||
assert len(client.async_send_command.call_args_list) == 1
|
||||
args = client.async_send_command.call_args_list[0][0][0]
|
||||
assert args["command"] == "driver.enable_statistics"
|
||||
assert args["applicationName"] == "Home Assistant"
|
||||
args = client.async_send_command.call_args_list[1][0][0]
|
||||
assert args["command"] == "driver.enable_error_reporting"
|
||||
assert entry.data[CONF_DATA_COLLECTION_OPTED_IN]
|
||||
|
||||
client.async_send_command.reset_mock()
|
||||
|
||||
|
@ -3616,7 +3621,7 @@ async def test_data_collection(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test FailedZWaveCommand is caught
|
||||
with patch(
|
||||
|
@ -3635,7 +3640,7 @@ async def test_data_collection(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -3710,7 +3715,7 @@ async def test_abort_firmware_update(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -3787,7 +3792,7 @@ async def test_is_node_firmware_update_in_progress(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -4153,7 +4158,7 @@ async def test_get_node_firmware_update_capabilities(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -4224,7 +4229,7 @@ async def test_is_any_ota_firmware_update_in_progress(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -4300,7 +4305,7 @@ async def test_check_for_config_updates(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
@ -4367,7 +4372,7 @@ async def test_install_config_update(
|
|||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "zwave_error"
|
||||
assert msg["error"]["message"] == "Z-Wave error 1: error message"
|
||||
assert msg["error"]["message"] == "zwave_error: Z-Wave error 1 - error message"
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
|
|
@ -144,6 +144,7 @@ async def test_if_notification_notification_fires(
|
|||
"source": "node",
|
||||
"event": "notification",
|
||||
"nodeId": node.node_id,
|
||||
"endpointIndex": 0,
|
||||
"ccId": 113,
|
||||
"args": {
|
||||
"type": 6,
|
||||
|
@ -273,6 +274,7 @@ async def test_if_entry_control_notification_fires(
|
|||
"source": "node",
|
||||
"event": "notification",
|
||||
"nodeId": node.node_id,
|
||||
"endpointIndex": 0,
|
||||
"ccId": 111,
|
||||
"args": {
|
||||
"eventType": 5,
|
||||
|
|
|
@ -156,6 +156,7 @@ async def test_notifications(
|
|||
"source": "node",
|
||||
"event": "notification",
|
||||
"nodeId": 32,
|
||||
"endpointIndex": 0,
|
||||
"ccId": 113,
|
||||
"args": {
|
||||
"type": 6,
|
||||
|
@ -187,6 +188,7 @@ async def test_notifications(
|
|||
"source": "node",
|
||||
"event": "notification",
|
||||
"nodeId": 32,
|
||||
"endpointIndex": 0,
|
||||
"ccId": 111,
|
||||
"args": {
|
||||
"eventType": 5,
|
||||
|
@ -219,6 +221,7 @@ async def test_notifications(
|
|||
"source": "node",
|
||||
"event": "notification",
|
||||
"nodeId": 32,
|
||||
"endpointIndex": 0,
|
||||
"ccId": 38,
|
||||
"args": {"eventType": 4, "eventTypeLabel": "test1", "direction": "up"},
|
||||
},
|
||||
|
@ -320,6 +323,7 @@ async def test_power_level_notification(
|
|||
"source": "node",
|
||||
"event": "notification",
|
||||
"nodeId": 7,
|
||||
"endpointIndex": 0,
|
||||
"ccId": 115,
|
||||
"args": {
|
||||
"commandClassName": "Powerlevel",
|
||||
|
@ -363,6 +367,7 @@ async def test_unknown_notification(
|
|||
"source": "node",
|
||||
"event": "notification",
|
||||
"nodeId": node.node_id,
|
||||
"endpointIndex": 0,
|
||||
"ccId": 0,
|
||||
"args": {
|
||||
"commandClassName": "No Operation",
|
||||
|
|
|
@ -38,24 +38,54 @@ UPDATE_ENTITY = "update.z_wave_thermostat_firmware"
|
|||
LATEST_VERSION_FIRMWARE = {
|
||||
"version": "11.2.4",
|
||||
"changelog": "blah 2",
|
||||
"channel": "stable",
|
||||
"files": [{"target": 0, "url": "https://example2.com", "integrity": "sha2"}],
|
||||
"downgrade": True,
|
||||
"normalizedVersion": "11.2.4",
|
||||
"device": {
|
||||
"manufacturerId": 1,
|
||||
"productType": 2,
|
||||
"productId": 3,
|
||||
"firmwareVersion": "0.4.4",
|
||||
"rfRegion": 1,
|
||||
},
|
||||
}
|
||||
FIRMWARE_UPDATES = {
|
||||
"updates": [
|
||||
{
|
||||
"version": "10.11.1",
|
||||
"changelog": "blah 1",
|
||||
"channel": "stable",
|
||||
"files": [
|
||||
{"target": 0, "url": "https://example1.com", "integrity": "sha1"}
|
||||
],
|
||||
"downgrade": True,
|
||||
"normalizedVersion": "10.11.1",
|
||||
"device": {
|
||||
"manufacturerId": 1,
|
||||
"productType": 2,
|
||||
"productId": 3,
|
||||
"firmwareVersion": "0.4.4",
|
||||
"rfRegion": 1,
|
||||
},
|
||||
},
|
||||
LATEST_VERSION_FIRMWARE,
|
||||
{
|
||||
"version": "11.1.5",
|
||||
"changelog": "blah 3",
|
||||
"channel": "stable",
|
||||
"files": [
|
||||
{"target": 0, "url": "https://example3.com", "integrity": "sha3"}
|
||||
],
|
||||
"downgrade": True,
|
||||
"normalizedVersion": "11.1.5",
|
||||
"device": {
|
||||
"manufacturerId": 1,
|
||||
"productType": 2,
|
||||
"productId": 3,
|
||||
"firmwareVersion": "0.4.4",
|
||||
"rfRegion": 1,
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -745,7 +775,23 @@ async def test_update_entity_full_restore_data_update_available(
|
|||
assert client.async_send_command.call_args_list[1][0][0] == {
|
||||
"command": "controller.firmware_update_ota",
|
||||
"nodeId": climate_radio_thermostat_ct100_plus_different_endpoints.node_id,
|
||||
"updates": [{"target": 0, "url": "https://example2.com", "integrity": "sha2"}],
|
||||
"updateInfo": {
|
||||
"version": "11.2.4",
|
||||
"changelog": "blah 2",
|
||||
"channel": "stable",
|
||||
"files": [
|
||||
{"target": 0, "url": "https://example2.com", "integrity": "sha2"}
|
||||
],
|
||||
"downgrade": True,
|
||||
"normalizedVersion": "11.2.4",
|
||||
"device": {
|
||||
"manufacturerId": 1,
|
||||
"productType": 2,
|
||||
"productId": 3,
|
||||
"firmwareVersion": "0.4.4",
|
||||
"rfRegion": 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
install_task.cancel()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue