diff --git a/homeassistant/components/mqtt_statestream.py b/homeassistant/components/mqtt_statestream.py index 4427870c294..205a638c574 100644 --- a/homeassistant/components/mqtt_statestream.py +++ b/homeassistant/components/mqtt_statestream.py @@ -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 diff --git a/tests/components/test_mqtt_statestream.py b/tests/components/test_mqtt_statestream.py index 76d8e48d03a..e120c3a7dd2 100644 --- a/tests/components/test_mqtt_statestream.py +++ b/tests/components/test_mqtt_statestream.py @@ -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) ]