We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4571512 commit 1ffb28cCopy full SHA for 1ffb28c
plugwise_usb/network/cache.py
@@ -45,9 +45,14 @@ async def restore_cache(self) -> None:
45
for mac, node_value in data.items():
46
node_type: NodeType | None = None
47
if len(node_value) >= 10:
48
- node_type = NodeType[node_value[9:]]
49
- if node_type is not None:
50
- self._nodetypes[mac] = node_type
+ try:
+ node_type = NodeType[node_value[9:]]
+ except KeyError:
51
+ node_type = None
52
+ if node_type is None:
53
+ _LOGGER.warning("Invalid NodeType in cache: %s", node_value)
54
+ continue
55
+ self._nodetypes[mac] = node_type
56
_LOGGER.debug(
57
"Restore NodeType for mac %s with node type %s",
58
mac,
0 commit comments