More robust node_to_dict code in case of race conditions where some of the attributes required to generate id_on_network are not available

This commit is contained in:
Fabio Manganiello 2020-06-11 14:50:41 +02:00
parent 4e8876309c
commit fb58c89911
1 changed files with 6 additions and 0 deletions

View File

@ -245,6 +245,12 @@ class ZwavePlugin(Plugin):
'values': {
value.id_on_network: cls.value_to_dict(value)
for value_id, value in (node.values or {}).items()
if value.index is not None
and value.instance is not None
and value.command_class
and value.parent_id is not None
and value._network
and value._network.home_id is not None
} if hasattr(node, 'values') else {},
}