mqtt_statestream: Update to append 'state' to topic for future use with mqtt discovery (#9446)
This commit is contained in:
parent
a7bce5f9e6
commit
04bed51277
2 changed files with 4 additions and 4 deletions
|
@ -38,7 +38,7 @@ def async_setup(hass, config):
|
||||||
return
|
return
|
||||||
payload = new_state.state
|
payload = new_state.state
|
||||||
|
|
||||||
topic = base_topic + entity_id.replace('.', '/')
|
topic = base_topic + entity_id.replace('.', '/') + '/state'
|
||||||
hass.components.mqtt.async_publish(topic, payload, 1, True)
|
hass.components.mqtt.async_publish(topic, payload, 1, True)
|
||||||
|
|
||||||
async_track_state_change(hass, MATCH_ALL, _state_publisher)
|
async_track_state_change(hass, MATCH_ALL, _state_publisher)
|
||||||
|
|
|
@ -59,7 +59,7 @@ class TestMqttStateStream(object):
|
||||||
mock_state_change_event(self.hass, State(e_id, 'on'))
|
mock_state_change_event(self.hass, State(e_id, 'on'))
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
|
|
||||||
# Make sure 'on' was published to pub/fake/entity
|
# Make sure 'on' was published to pub/fake/entity/state
|
||||||
mock_pub.assert_called_with(self.hass, 'pub/fake/entity', 'on', 1,
|
mock_pub.assert_called_with(self.hass, 'pub/fake/entity/state',
|
||||||
True)
|
'on', 1, True)
|
||||||
assert mock_pub.called
|
assert mock_pub.called
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue