Reconfigure MQTT binary_sensor component if discovery info is changed (#18169)

* Recreate component if discovery info is changed

* Update component instead of remove+add

* Set name and unique_id in __init__

* Update unit test

* Cleanup

* More cleanup

* Refactor according to review comments

* Change discovery_hash

* Review comments, add tests

* Fix handling of value_template
This commit is contained in:
emontnemery 2018-11-19 16:49:04 +01:00 committed by Paulus Schoutsen
parent 01953ab46b
commit de9bac9ee3
8 changed files with 431 additions and 66 deletions

View file

@ -295,6 +295,7 @@ def async_mock_mqtt_component(hass, config=None):
with patch('paho.mqtt.client.Client') as mock_client:
mock_client().connect.return_value = 0
mock_client().subscribe.return_value = (0, 0)
mock_client().unsubscribe.return_value = (0, 0)
mock_client().publish.return_value = (0, 0)
result = yield from async_setup_component(hass, mqtt.DOMAIN, {