Made _is_switch more resilient against rogue Z-Wave values

This commit is contained in:
Fabio Manganiello 2022-05-01 22:18:46 +02:00
parent 117f92e5b4
commit f57f940d57
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -462,7 +462,9 @@ class ZwaveMqttPlugin(MqttPlugin, ZwaveBasePlugin):
@staticmethod @staticmethod
def _is_switch(value: Mapping): def _is_switch(value: Mapping):
return value.get('command_class_name', '').endswith('Switch') return (
value.get('command_class_name', '').endswith('Switch') if value else False
)
def transform_entities(self, values: Iterable[Mapping]): def transform_entities(self, values: Iterable[Mapping]):
entities = [] entities = []