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:
blackwind authored and Paulus Schoutsen committed 2018-05-05 09:31:39 -04:00
1 parent 5ade84d75f
commit ec3ce4c80d
2 files changed
+5 -6

No files matched your search

+2 -2
View File
@@ -134,7 +134,7 @@ class TestMqttStateStream(object):
test_attributes = {
"testing": "YES",
"list": ["a", "b", "c"],
"bool": True
"bool": False
}
# Set a state of an entity
@@ -150,7 +150,7 @@ class TestMqttStateStream(object):
1, True),
call.async_publish(self.hass, 'pub/fake/entity/list',
'["a", "b", "c"]', 1, True),
call.async_publish(self.hass, 'pub/fake/entity/bool', "true",
call.async_publish(self.hass, 'pub/fake/entity/bool', "false",
1, True)
]