Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump zwave-js-server-python to 0.52.0 #100833

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 32 additions & 23 deletions homeassistant/components/zwave_js/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1379,25 +1379,25 @@ def node_removed(event: dict) -> None:
@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],
entry: ConfigEntry,
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,
Expand All @@ -1407,21 +1407,21 @@ 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],
entry: ConfigEntry,
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
Expand All @@ -1434,40 +1434,49 @@ def async_cleanup() -> None:
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],
entry: ConfigEntry,
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,
Expand All @@ -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],
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/zwave_js/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zwave_js/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 7 additions & 4 deletions homeassistant/components/zwave_js/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ def as_dict(self) -> dict[str, Any]:
@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))
Expand Down Expand Up @@ -267,9 +272,7 @@ async def async_install(
)

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
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2809,7 +2809,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
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,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
Loading