Remove discovered MQTT alarm_control_panel device when discovery topic is cleared (#16825)
This commit is contained in:
1 parent
e78f4d1b65
commit
42790d3e97
2 files changed
+44
-9
No files matched your search
@@ -209,3 +209,28 @@ def test_discovery_removal(hass, mqtt_mock, caplog):
|
||||
|
||||
state = hass.states.get('switch.beer')
|
||||
assert state is None
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_discovery_removal_alarm(hass, mqtt_mock, caplog):
|
||||
"""Test removal of discovered alarm_control_panel."""
|
||||
yield from async_start(hass, 'homeassistant', {})
|
||||
data = (
|
||||
'{ "name": "Beer",'
|
||||
' "status_topic": "test_topic",'
|
||||
' "command_topic": "test_topic" }'
|
||||
)
|
||||
async_fire_mqtt_message(hass,
|
||||
'homeassistant/alarm_control_panel/bla/config',
|
||||
data)
|
||||
yield from hass.async_block_till_done()
|
||||
state = hass.states.get('alarm_control_panel.beer')
|
||||
assert state is not None
|
||||
assert state.name == 'Beer'
|
||||
async_fire_mqtt_message(hass,
|
||||
'homeassistant/alarm_control_panel/bla/config',
|
||||
'')
|
||||
yield from hass.async_block_till_done()
|
||||
yield from hass.async_block_till_done()
|
||||
state = hass.states.get('alarm_control_panel.beer')
|
||||
assert state is None
|
||||
Reference in new issue
Block a user