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: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 3 additions and 1 deletions

View File

@ -462,7 +462,9 @@ class ZwaveMqttPlugin(MqttPlugin, ZwaveBasePlugin):
@staticmethod
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]):
entities = []