From fb58c8991182f1343883829f0ca497aa13fbf3df Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 11 Jun 2020 14:50:41 +0200 Subject: [PATCH] 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 --- platypush/plugins/zwave/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platypush/plugins/zwave/__init__.py b/platypush/plugins/zwave/__init__.py index 81485444..667d4e28 100644 --- a/platypush/plugins/zwave/__init__.py +++ b/platypush/plugins/zwave/__init__.py @@ -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 {}, }