Adds MQTT Fan Discovery (#9463)

This commit is contained in:
Walter Huf 2017-09-17 02:32:22 -07:00 committed by Pascal Vizeli
parent bda6d2c696
commit 8a3f8457e8
3 changed files with 22 additions and 1 deletions

View file

@ -77,6 +77,23 @@ def test_correct_config_discovery(hass, mqtt_mock, caplog):
assert ('binary_sensor', 'bla') in hass.data[ALREADY_DISCOVERED]
@asyncio.coroutine
def test_discover_fan(hass, mqtt_mock, caplog):
"""Test discovering an MQTT fan."""
yield from async_start(hass, 'homeassistant', {})
async_fire_mqtt_message(hass, 'homeassistant/fan/bla/config',
('{ "name": "Beer",'
' "command_topic": "test_topic" }'))
yield from hass.async_block_till_done()
state = hass.states.get('fan.beer')
assert state is not None
assert state.name == 'Beer'
assert ('fan', 'bla') in hass.data[ALREADY_DISCOVERED]
@asyncio.coroutine
def test_discovery_incl_nodeid(hass, mqtt_mock, caplog):
"""Test sending in correct JSON with optional node_id included."""