[zigbee.mqtt] Added more logging lines on device_set action.

This commit is contained in:
Fabio Manganiello 2024-08-09 11:03:04 +02:00
parent b8b70f43c0
commit d70737ea2b
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -1154,6 +1154,14 @@ class ZigbeeMqttPlugin(
if self._is_write_only(stored_property): if self._is_write_only(stored_property):
reply_topic = None reply_topic = None
if property and reply_topic:
self.logger.debug(
'Waiting for updated value of %s for device %s, reply topic: %s',
property,
device,
reply_topic,
)
properties = self._run_request( properties = self._run_request(
topic=self._topic(device + '/set'), topic=self._topic(device + '/set'),
reply_topic=reply_topic, reply_topic=reply_topic,
@ -1162,9 +1170,22 @@ class ZigbeeMqttPlugin(
) )
if property and reply_topic: if property and reply_topic:
assert ( if property not in (properties or {}):
property in properties self.logger.warning(
), f'Could not retrieve the new state for {property}' (
'Could not retrieve value of property %s on device %s, '
'reply topic: %s, retrieved properties: %s',
),
property,
device,
reply_topic,
properties,
)
raise AssertionError(
f'Cound not retrieve the new state for {property} on device {device}'
)
return {property: properties[property]} return {property: properties[property]}
return properties return properties
@ -1670,9 +1691,11 @@ class ZigbeeMqttPlugin(
prop, prop,
prop_info.get( prop_info.get(
'value_toggle', 'value_toggle',
(
'OFF' 'OFF'
if device_state.get(prop) == prop_info.get('value_on', 'ON') if device_state.get(prop) == prop_info.get('value_on', 'ON')
else 'ON', else 'ON'
),
), ),
) )