Publish attributes unconditionally (#14179)
* Publish attributes unconditionally Because the attribute publish command was previously hidden behind `if val:`, falsy values like False and 0.0 weren't being published, thereby making Statestream -- particularly in the case of booleans, where the first True would be retained indefinitely -- a completely worthless indicator of state. * Change bool test to False to confirm falsy values pass
This commit is contained in:
parent
5ade84d75f
commit
ec3ce4c80d
2 changed files with 5 additions and 6 deletions
|
@ -88,10 +88,9 @@ def async_setup(hass, config):
|
|||
|
||||
if publish_attributes:
|
||||
for key, val in new_state.attributes.items():
|
||||
if val:
|
||||
encoded_val = json.dumps(val, cls=JSONEncoder)
|
||||
hass.components.mqtt.async_publish(mybase + key,
|
||||
encoded_val, 1, True)
|
||||
encoded_val = json.dumps(val, cls=JSONEncoder)
|
||||
hass.components.mqtt.async_publish(mybase + key,
|
||||
encoded_val, 1, True)
|
||||
|
||||
async_track_state_change(hass, MATCH_ALL, _state_publisher)
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue