mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Use ZeroconfServiceInfo in rainmachine (#60055)
This commit is contained in:
parent
e056f9aa0f
commit
85b37a8532
@ -70,7 +70,7 @@ class RainMachineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
||||
) -> FlowResult:
|
||||
"""Handle discovery via zeroconf."""
|
||||
ip_address = discovery_info["host"]
|
||||
ip_address = discovery_info[zeroconf.ATTR_HOST]
|
||||
|
||||
self._async_abort_entries_match({CONF_IP_ADDRESS: ip_address})
|
||||
# Handle IP change
|
||||
|
@ -5,6 +5,7 @@ import pytest
|
||||
from regenmaschine.errors import RainMachineError
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components import zeroconf
|
||||
from homeassistant.components.rainmachine import CONF_ZONE_RUN_TIME, DOMAIN
|
||||
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_PORT, CONF_SSL
|
||||
|
||||
@ -171,7 +172,7 @@ async def test_step_homekit_zeroconf_ip_already_exists(hass, source):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": source},
|
||||
data={"host": "192.168.1.100"},
|
||||
data=zeroconf.ZeroconfServiceInfo(host="192.168.1.100"),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
@ -200,7 +201,7 @@ async def test_step_homekit_zeroconf_ip_change(hass, source):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": source},
|
||||
data={"host": "192.168.1.2"},
|
||||
data=zeroconf.ZeroconfServiceInfo(host="192.168.1.2"),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
@ -231,7 +232,7 @@ async def test_step_homekit_zeroconf_new_controller_when_some_exist(hass, source
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": source},
|
||||
data={"host": "192.168.1.100"},
|
||||
data=zeroconf.ZeroconfServiceInfo(host="192.168.1.100"),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
@ -275,7 +276,7 @@ async def test_discovery_by_homekit_and_zeroconf_same_time(hass):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||
data={"host": "192.168.1.100"},
|
||||
data=zeroconf.ZeroconfServiceInfo(host="192.168.1.100"),
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
@ -288,7 +289,7 @@ async def test_discovery_by_homekit_and_zeroconf_same_time(hass):
|
||||
result2 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_HOMEKIT},
|
||||
data={"host": "192.168.1.100"},
|
||||
data=zeroconf.ZeroconfServiceInfo(host="192.168.1.100"),
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
|
Loading…
x
Reference in New Issue
Block a user