Compare commits
2 commits
master
...
fix-zigbee
Author | SHA1 | Date | |
---|---|---|---|
e6c1cccba9 | |||
c5ddc6b3d7 |
1 changed files with 6 additions and 19 deletions
|
@ -1131,7 +1131,6 @@ class ZigbeeMqttPlugin(
|
|||
the default configured device).
|
||||
"""
|
||||
msg = (values or {}).copy()
|
||||
reply_topic = None
|
||||
device_info = self._get_device_info(device, **kwargs)
|
||||
assert device_info, f'No such device: {device}'
|
||||
device = self._preferred_name(device_info)
|
||||
|
@ -1143,32 +1142,18 @@ class ZigbeeMqttPlugin(
|
|||
return self.device_set_option(device, property, value, **kwargs)
|
||||
|
||||
# Check if it's a property
|
||||
reply_topic = self._topic(device)
|
||||
stored_property = self._get_properties(device_info).get(property)
|
||||
assert stored_property, f'No such property: {property}'
|
||||
|
||||
# Set the new value on the message
|
||||
msg[property] = value
|
||||
|
||||
# Don't wait for an update from a value that is not readable
|
||||
if self._is_write_only(stored_property):
|
||||
reply_topic = None
|
||||
|
||||
properties = self._run_request(
|
||||
self._run_request(
|
||||
topic=self._topic(device + '/set'),
|
||||
reply_topic=reply_topic,
|
||||
msg=msg,
|
||||
**self._mqtt_args(**kwargs),
|
||||
)
|
||||
|
||||
if property and reply_topic:
|
||||
assert (
|
||||
property in properties
|
||||
), f'Could not retrieve the new state for {property}'
|
||||
return {property: properties[property]}
|
||||
|
||||
return properties
|
||||
|
||||
@action
|
||||
# pylint: disable=redefined-builtin
|
||||
def set_value(
|
||||
|
@ -1670,9 +1655,11 @@ class ZigbeeMqttPlugin(
|
|||
prop,
|
||||
prop_info.get(
|
||||
'value_toggle',
|
||||
(
|
||||
'OFF'
|
||||
if device_state.get(prop) == prop_info.get('value_on', 'ON')
|
||||
else 'ON',
|
||||
else 'ON'
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue