Skip to content

Commit

Permalink
handle additional upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
raman325 committed Jul 29, 2023
1 parent c3481aa commit bcb8777
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 77 deletions.
22 changes: 18 additions & 4 deletions homeassistant/components/zwave_js/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import annotations

from copy import deepcopy
from typing import Any
from typing import Any, cast

from zwave_js_server.client import Client
from zwave_js_server.const import CommandClass
Expand Down Expand Up @@ -129,8 +129,8 @@ async def async_get_config_entry_diagnostics(
handshake_msgs = msgs[:-1]
network_state = msgs[-1]
network_state["result"]["state"]["nodes"] = [
redact_node_state(async_redact_data(node, KEYS_TO_REDACT))
for node in network_state["result"]["state"]["nodes"]
redact_node_state(async_redact_data(node_data, KEYS_TO_REDACT))
for node_data in network_state["result"]["state"]["nodes"]
]
return {"messages": [*handshake_msgs, network_state]}

Expand All @@ -148,7 +148,21 @@ async def async_get_device_diagnostics(
node = driver.controller.nodes[node_id]
entities = get_device_entities(hass, node, config_entry, device)
assert client.version
node_state = redact_node_state(async_redact_data(node.data, KEYS_TO_REDACT))
node_state = redact_node_state(
async_redact_data(
cast(
NodeDataType,
{
**node.data,
"values": [value.data for value in node.values.values()],
"endpoints": [
endpoint.data for endpoint in node.endpoints.values()
],
},
),
KEYS_TO_REDACT,
)
)
return {
"versionInfo": {
"driverVersion": client.version.driver_version,
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/zwave_js/triggers/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from collections.abc import Callable
import functools

from pydantic import ValidationError
import voluptuous as vol
from zwave_js_server.client import Client
from zwave_js_server.model.controller import CONTROLLER_EVENT_MODEL_MAP
Expand All @@ -18,6 +17,11 @@
from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo
from homeassistant.helpers.typing import ConfigType

try:
from pydantic.v1 import ValidationError
except ImportError:
from pydantic import ValidationError

from ..const import (
ATTR_CONFIG_ENTRY_ID,
ATTR_EVENT,
Expand Down
Loading

0 comments on commit bcb8777

Please sign in to comment.