forked from platypush/platypush
Publish a switch entity from zigbee.mqtt only if the update includes its state
This commit is contained in:
parent
20530c2b6d
commit
548d487e73
1 changed files with 3 additions and 3 deletions
|
@ -182,7 +182,7 @@ class ZigbeeMqttPlugin(MqttPlugin, SwitchPlugin): # lgtm [py/missing-call-to-in
|
|||
}
|
||||
|
||||
switch_info = self._get_switch_meta(dev)
|
||||
if switch_info:
|
||||
if switch_info and dev.get('state', {}).get('state') is not None:
|
||||
converted_entity = Switch(
|
||||
id=dev['ieee_address'],
|
||||
name=dev.get('friendly_name'),
|
||||
|
@ -722,9 +722,9 @@ class ZigbeeMqttPlugin(MqttPlugin, SwitchPlugin): # lgtm [py/missing-call-to-in
|
|||
).output
|
||||
|
||||
if device_info:
|
||||
self.publish_entities(
|
||||
self.publish_entities( # type: ignore
|
||||
[
|
||||
{ # type: ignore
|
||||
{
|
||||
**device_info,
|
||||
'state': device_state,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue