1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Add MQTT integration discovery (#41332)

* Add MQTT integration discovery

* Add script/hassfest/mqtt.py

* Unsubscribe if config entry exists

* Add homeassistant/generated/mqtt.py

* Fix bad loop

* Improve tests

* Improve tests

* Apply suggestions from code review

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>

* Prevent initiating multiple config flows

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
This commit is contained in:
Erik Montnemery
2020-10-07 18:30:51 +02:00
committed by GitHub
parent 3f263d5cbe
commit 343e5d64b8
21 changed files with 400 additions and 24 deletions

View File

@@ -81,7 +81,7 @@ async def test_user_has_confirmation(hass, discovery_flow_conf):
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
@pytest.mark.parametrize("source", ["discovery", "ssdp", "zeroconf"])
@pytest.mark.parametrize("source", ["discovery", "mqtt", "ssdp", "zeroconf"])
async def test_discovery_single_instance(hass, discovery_flow_conf, source):
"""Test we not allow duplicates."""
flow = config_entries.HANDLERS["test"]()
@@ -95,7 +95,7 @@ async def test_discovery_single_instance(hass, discovery_flow_conf, source):
assert result["reason"] == "single_instance_allowed"
@pytest.mark.parametrize("source", ["discovery", "ssdp", "zeroconf"])
@pytest.mark.parametrize("source", ["discovery", "mqtt", "ssdp", "zeroconf"])
async def test_discovery_confirmation(hass, discovery_flow_conf, source):
"""Test we ask for confirmation via discovery."""
flow = config_entries.HANDLERS["test"]()