mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Rename zeroconf service info (#59467)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
6cba03aa4a
commit
ab1e14204f
@ -61,7 +61,7 @@ MAX_PROPERTY_VALUE_LEN = 230
|
|||||||
# Dns label max length
|
# Dns label max length
|
||||||
MAX_NAME_LEN = 63
|
MAX_NAME_LEN = 63
|
||||||
|
|
||||||
# Attributes for HaServiceInfo
|
# Attributes for ZeroconfServiceInfo
|
||||||
ATTR_HOST: Final = "host"
|
ATTR_HOST: Final = "host"
|
||||||
ATTR_HOSTNAME: Final = "hostname"
|
ATTR_HOSTNAME: Final = "hostname"
|
||||||
ATTR_NAME: Final = "name"
|
ATTR_NAME: Final = "name"
|
||||||
@ -87,7 +87,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HaServiceInfo(TypedDict):
|
class ZeroconfServiceInfo(TypedDict):
|
||||||
"""Prepared info from mDNS entries."""
|
"""Prepared info from mDNS entries."""
|
||||||
|
|
||||||
host: str
|
host: str
|
||||||
@ -466,7 +466,7 @@ def async_get_homekit_discovery_domain(
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def info_from_service(service: AsyncServiceInfo) -> HaServiceInfo | None:
|
def info_from_service(service: AsyncServiceInfo) -> ZeroconfServiceInfo | None:
|
||||||
"""Return prepared info from mDNS entries."""
|
"""Return prepared info from mDNS entries."""
|
||||||
properties: dict[str, Any] = {"_raw": {}}
|
properties: dict[str, Any] = {"_raw": {}}
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ def info_from_service(service: AsyncServiceInfo) -> HaServiceInfo | None:
|
|||||||
if (host := _first_non_link_local_or_v6_address(addresses)) is None:
|
if (host := _first_non_link_local_or_v6_address(addresses)) is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return HaServiceInfo(
|
return ZeroconfServiceInfo(
|
||||||
host=str(host),
|
host=str(host),
|
||||||
port=service.port,
|
port=service.port,
|
||||||
hostname=service.server,
|
hostname=service.server,
|
||||||
|
@ -12,7 +12,7 @@ from homeassistant.components.apple_tv.const import CONF_START_OFF, DOMAIN
|
|||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
DMAP_SERVICE = zeroconf.HaServiceInfo(
|
DMAP_SERVICE = zeroconf.ZeroconfServiceInfo(
|
||||||
type="_touch-able._tcp.local.",
|
type="_touch-able._tcp.local.",
|
||||||
name="dmapid.something",
|
name="dmapid.something",
|
||||||
properties={"CtlN": "Apple TV"},
|
properties={"CtlN": "Apple TV"},
|
||||||
@ -400,7 +400,7 @@ async def test_zeroconf_unsupported_service_aborts(hass):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
type="_dummy._tcp.local.",
|
type="_dummy._tcp.local.",
|
||||||
properties={},
|
properties={},
|
||||||
),
|
),
|
||||||
@ -414,7 +414,7 @@ async def test_zeroconf_add_mrp_device(hass, mrp_device, pairing):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
type="_mediaremotetv._tcp.local.",
|
type="_mediaremotetv._tcp.local.",
|
||||||
properties={"UniqueIdentifier": "mrpid", "Name": "Kitchen"},
|
properties={"UniqueIdentifier": "mrpid", "Name": "Kitchen"},
|
||||||
),
|
),
|
||||||
|
@ -293,7 +293,7 @@ async def test_reauth_flow_update_configuration(hass):
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
SOURCE_ZEROCONF,
|
SOURCE_ZEROCONF,
|
||||||
zeroconf.HaServiceInfo(
|
zeroconf.ZeroconfServiceInfo(
|
||||||
host=DEFAULT_HOST,
|
host=DEFAULT_HOST,
|
||||||
port=80,
|
port=80,
|
||||||
hostname=f"axis-{MAC.lower()}.local.",
|
hostname=f"axis-{MAC.lower()}.local.",
|
||||||
@ -363,7 +363,7 @@ async def test_discovery_flow(hass, source: str, discovery_info: dict):
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
SOURCE_ZEROCONF,
|
SOURCE_ZEROCONF,
|
||||||
zeroconf.HaServiceInfo(
|
zeroconf.ZeroconfServiceInfo(
|
||||||
host=DEFAULT_HOST,
|
host=DEFAULT_HOST,
|
||||||
port=80,
|
port=80,
|
||||||
name=f"AXIS M1065-LW - {MAC}._axis-video._tcp.local.",
|
name=f"AXIS M1065-LW - {MAC}._axis-video._tcp.local.",
|
||||||
@ -411,7 +411,7 @@ async def test_discovered_device_already_configured(
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
SOURCE_ZEROCONF,
|
SOURCE_ZEROCONF,
|
||||||
zeroconf.HaServiceInfo(
|
zeroconf.ZeroconfServiceInfo(
|
||||||
host="2.3.4.5",
|
host="2.3.4.5",
|
||||||
port=8080,
|
port=8080,
|
||||||
name=f"AXIS M1065-LW - {MAC}._axis-video._tcp.local.",
|
name=f"AXIS M1065-LW - {MAC}._axis-video._tcp.local.",
|
||||||
@ -479,7 +479,7 @@ async def test_discovery_flow_updated_configuration(
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
SOURCE_ZEROCONF,
|
SOURCE_ZEROCONF,
|
||||||
zeroconf.HaServiceInfo(
|
zeroconf.ZeroconfServiceInfo(
|
||||||
host="",
|
host="",
|
||||||
port=0,
|
port=0,
|
||||||
name="",
|
name="",
|
||||||
@ -517,7 +517,7 @@ async def test_discovery_flow_ignore_non_axis_device(
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
SOURCE_ZEROCONF,
|
SOURCE_ZEROCONF,
|
||||||
zeroconf.HaServiceInfo(
|
zeroconf.ZeroconfServiceInfo(
|
||||||
host="169.254.3.4",
|
host="169.254.3.4",
|
||||||
port=80,
|
port=80,
|
||||||
name=f"AXIS M1065-LW - {MAC}._axis-video._tcp.local.",
|
name=f"AXIS M1065-LW - {MAC}._axis-video._tcp.local.",
|
||||||
|
@ -197,7 +197,7 @@ async def test_zeroconf_form(hass: core.HomeAssistant):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
name="test-bond-id.some-other-tail-info", host="test-host"
|
name="test-bond-id.some-other-tail-info", host="test-host"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -229,7 +229,7 @@ async def test_zeroconf_form_token_unavailable(hass: core.HomeAssistant):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
name="test-bond-id.some-other-tail-info", host="test-host"
|
name="test-bond-id.some-other-tail-info", host="test-host"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -264,7 +264,7 @@ async def test_zeroconf_form_with_token_available(hass: core.HomeAssistant):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
name="test-bond-id.some-other-tail-info", host="test-host"
|
name="test-bond-id.some-other-tail-info", host="test-host"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -302,7 +302,7 @@ async def test_zeroconf_already_configured(hass: core.HomeAssistant):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
name="already-registered-bond-id.some-other-tail-info",
|
name="already-registered-bond-id.some-other-tail-info",
|
||||||
host="updated-host",
|
host="updated-host",
|
||||||
),
|
),
|
||||||
@ -343,7 +343,7 @@ async def test_zeroconf_already_configured_refresh_token(hass: core.HomeAssistan
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
name="already-registered-bond-id.some-other-tail-info",
|
name="already-registered-bond-id.some-other-tail-info",
|
||||||
host="updated-host",
|
host="updated-host",
|
||||||
),
|
),
|
||||||
@ -376,7 +376,7 @@ async def test_zeroconf_already_configured_no_reload_same_host(
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
name="already-registered-bond-id.some-other-tail-info",
|
name="already-registered-bond-id.some-other-tail-info",
|
||||||
host="stored-host",
|
host="stored-host",
|
||||||
),
|
),
|
||||||
@ -393,7 +393,7 @@ async def test_zeroconf_form_unexpected_error(hass: core.HomeAssistant):
|
|||||||
await _help_test_form_unexpected_error(
|
await _help_test_form_unexpected_error(
|
||||||
hass,
|
hass,
|
||||||
source=config_entries.SOURCE_ZEROCONF,
|
source=config_entries.SOURCE_ZEROCONF,
|
||||||
initial_input=zeroconf.HaServiceInfo(
|
initial_input=zeroconf.ZeroconfServiceInfo(
|
||||||
name="test-bond-id.some-other-tail-info",
|
name="test-bond-id.some-other-tail-info",
|
||||||
host="test-host",
|
host="test-host",
|
||||||
),
|
),
|
||||||
|
@ -20,7 +20,7 @@ MOCK_SETTINGS = {
|
|||||||
"name": "Test name",
|
"name": "Test name",
|
||||||
"device": {"mac": "test-mac", "hostname": "test-host"},
|
"device": {"mac": "test-mac", "hostname": "test-host"},
|
||||||
}
|
}
|
||||||
DISCOVERY_INFO = zeroconf.HaServiceInfo(
|
DISCOVERY_INFO = zeroconf.ZeroconfServiceInfo(
|
||||||
host=["169.1.1.1", "1.1.1.1"],
|
host=["169.1.1.1", "1.1.1.1"],
|
||||||
port=0,
|
port=0,
|
||||||
hostname="shc012345.local.",
|
hostname="shc012345.local.",
|
||||||
@ -528,7 +528,7 @@ async def test_zeroconf_cannot_connect(hass, mock_zeroconf):
|
|||||||
|
|
||||||
async def test_zeroconf_link_local(hass, mock_zeroconf):
|
async def test_zeroconf_link_local(hass, mock_zeroconf):
|
||||||
"""Test we get the form."""
|
"""Test we get the form."""
|
||||||
DISCOVERY_INFO_LINK_LOCAL = zeroconf.HaServiceInfo(
|
DISCOVERY_INFO_LINK_LOCAL = zeroconf.ZeroconfServiceInfo(
|
||||||
host=["169.1.1.1"],
|
host=["169.1.1.1"],
|
||||||
port=0,
|
port=0,
|
||||||
hostname="shc012345.local.",
|
hostname="shc012345.local.",
|
||||||
@ -552,7 +552,7 @@ async def test_zeroconf_not_bosch_shc(hass, mock_zeroconf):
|
|||||||
"""Test we filter out non-bosch_shc devices."""
|
"""Test we filter out non-bosch_shc devices."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
data=zeroconf.HaServiceInfo(host="1.1.1.1", name="notboschshc"),
|
data=zeroconf.ZeroconfServiceInfo(host="1.1.1.1", name="notboschshc"),
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
)
|
)
|
||||||
assert result["type"] == "abort"
|
assert result["type"] == "abort"
|
||||||
|
@ -144,7 +144,7 @@ async def test_zeroconf_snmp_error(hass):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": SOURCE_ZEROCONF},
|
context={"source": SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
hostname="example.local.", name="Brother Printer"
|
hostname="example.local.", name="Brother Printer"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -159,7 +159,7 @@ async def test_zeroconf_unsupported_model(hass):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": SOURCE_ZEROCONF},
|
context={"source": SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
hostname="example.local.",
|
hostname="example.local.",
|
||||||
name="Brother Printer",
|
name="Brother Printer",
|
||||||
properties={"product": "MFC-8660DN"},
|
properties={"product": "MFC-8660DN"},
|
||||||
@ -184,7 +184,7 @@ async def test_zeroconf_device_exists_abort(hass):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": SOURCE_ZEROCONF},
|
context={"source": SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
hostname="example.local.", name="Brother Printer"
|
hostname="example.local.", name="Brother Printer"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -201,7 +201,9 @@ async def test_zeroconf_no_probe_existing_device(hass):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": SOURCE_ZEROCONF},
|
context={"source": SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(hostname="localhost", name="Brother Printer"),
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
|
hostname="localhost", name="Brother Printer"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
@ -220,7 +222,7 @@ async def test_zeroconf_confirm_create_entry(hass):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": SOURCE_ZEROCONF},
|
context={"source": SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
hostname="example.local.", name="Brother Printer"
|
hostname="example.local.", name="Brother Printer"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -120,7 +120,7 @@ async def test_api_password_abort(hass):
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"source, data, unique_id",
|
"source, data, unique_id",
|
||||||
[
|
[
|
||||||
(SOURCE_ZEROCONF, zeroconf.HaServiceInfo(host=HOST), MAC),
|
(SOURCE_ZEROCONF, zeroconf.ZeroconfServiceInfo(host=HOST), MAC),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_discovery_zeroconf(
|
async def test_discovery_zeroconf(
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from homeassistant.components import zeroconf
|
from homeassistant.components import zeroconf
|
||||||
|
|
||||||
DISCOVERY_INFO = zeroconf.HaServiceInfo(
|
DISCOVERY_INFO = zeroconf.ZeroconfServiceInfo(
|
||||||
host="192.168.0.1",
|
host="192.168.0.1",
|
||||||
port=14791,
|
port=14791,
|
||||||
hostname="test.local.",
|
hostname="test.local.",
|
||||||
@ -19,6 +19,8 @@ DISCOVERY_INFO = zeroconf.HaServiceInfo(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
DISCOVERY_INFO_WRONG_DEVOLO_DEVICE = zeroconf.HaServiceInfo(properties={"MT": "2700"})
|
DISCOVERY_INFO_WRONG_DEVOLO_DEVICE = zeroconf.ZeroconfServiceInfo(
|
||||||
|
properties={"MT": "2700"}
|
||||||
|
)
|
||||||
|
|
||||||
DISCOVERY_INFO_WRONG_DEVICE = zeroconf.HaServiceInfo(properties={"Features": ""})
|
DISCOVERY_INFO_WRONG_DEVICE = zeroconf.ZeroconfServiceInfo(properties={"Features": ""})
|
||||||
|
@ -16,7 +16,7 @@ CONNECTED_STATIONS = {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
DISCOVERY_INFO = zeroconf.HaServiceInfo(
|
DISCOVERY_INFO = zeroconf.ZeroconfServiceInfo(
|
||||||
host=IP,
|
host=IP,
|
||||||
port=14791,
|
port=14791,
|
||||||
hostname="test.local.",
|
hostname="test.local.",
|
||||||
@ -36,7 +36,7 @@ DISCOVERY_INFO = zeroconf.HaServiceInfo(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
DISCOVERY_INFO_WRONG_DEVICE = zeroconf.HaServiceInfo(properties={"MT": "2600"})
|
DISCOVERY_INFO_WRONG_DEVICE = zeroconf.ZeroconfServiceInfo(properties={"MT": "2600"})
|
||||||
|
|
||||||
NEIGHBOR_ACCESS_POINTS = {
|
NEIGHBOR_ACCESS_POINTS = {
|
||||||
"neighbor_aps": [
|
"neighbor_aps": [
|
||||||
|
@ -82,7 +82,7 @@ async def test_form_zeroconf_wrong_oui(hass):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
properties={"macaddress": "notdoorbirdoui"},
|
properties={"macaddress": "notdoorbirdoui"},
|
||||||
host="192.168.1.8",
|
host="192.168.1.8",
|
||||||
name="Doorstation - abc123._axis-video._tcp.local.",
|
name="Doorstation - abc123._axis-video._tcp.local.",
|
||||||
@ -98,7 +98,7 @@ async def test_form_zeroconf_link_local_ignored(hass):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
properties={"macaddress": "1CCAE3DOORBIRD"},
|
properties={"macaddress": "1CCAE3DOORBIRD"},
|
||||||
host="169.254.103.61",
|
host="169.254.103.61",
|
||||||
name="Doorstation - abc123._axis-video._tcp.local.",
|
name="Doorstation - abc123._axis-video._tcp.local.",
|
||||||
@ -121,7 +121,7 @@ async def test_form_zeroconf_correct_oui(hass):
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
properties={"macaddress": "1CCAE3DOORBIRD"},
|
properties={"macaddress": "1CCAE3DOORBIRD"},
|
||||||
name="Doorstation - abc123._axis-video._tcp.local.",
|
name="Doorstation - abc123._axis-video._tcp.local.",
|
||||||
host="192.168.1.5",
|
host="192.168.1.5",
|
||||||
@ -180,7 +180,7 @@ async def test_form_zeroconf_correct_oui_wrong_device(hass, doorbell_state_side_
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
properties={"macaddress": "1CCAE3DOORBIRD"},
|
properties={"macaddress": "1CCAE3DOORBIRD"},
|
||||||
name="Doorstation - abc123._axis-video._tcp.local.",
|
name="Doorstation - abc123._axis-video._tcp.local.",
|
||||||
host="192.168.1.5",
|
host="192.168.1.5",
|
||||||
|
@ -158,7 +158,7 @@ async def test_zeroconf(hass: HomeAssistant) -> None:
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
properties={"serialnum": "1234"},
|
properties={"serialnum": "1234"},
|
||||||
host="1.1.1.1",
|
host="1.1.1.1",
|
||||||
),
|
),
|
||||||
@ -254,7 +254,7 @@ async def test_zeroconf_serial_already_exists(hass: HomeAssistant) -> None:
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
properties={"serialnum": "1234"},
|
properties={"serialnum": "1234"},
|
||||||
host="1.1.1.1",
|
host="1.1.1.1",
|
||||||
),
|
),
|
||||||
@ -289,7 +289,7 @@ async def test_zeroconf_host_already_exists(hass: HomeAssistant) -> None:
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.HaServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
properties={"serialnum": "1234"},
|
properties={"serialnum": "1234"},
|
||||||
host="1.1.1.1",
|
host="1.1.1.1",
|
||||||
),
|
),
|
||||||
|
@ -18,7 +18,7 @@ from .const import MOCK_HOST, MOCK_PORT
|
|||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
MOCK_ZEROCONF_DATA = zeroconf.HaServiceInfo(
|
MOCK_ZEROCONF_DATA = zeroconf.ZeroconfServiceInfo(
|
||||||
host="192.168.0.254",
|
host="192.168.0.254",
|
||||||
port=80,
|
port=80,
|
||||||
hostname="Freebox-Server.local.",
|
hostname="Freebox-Server.local.",
|
||||||
|
@ -5,7 +5,7 @@ from unittest.mock import MagicMock, patch
|
|||||||
|
|
||||||
from aiolookin import Climate, Device, Remote
|
from aiolookin import Climate, Device, Remote
|
||||||
|
|
||||||
from homeassistant.components.zeroconf import HaServiceInfo
|
from homeassistant.components.zeroconf import ZeroconfServiceInfo
|
||||||
|
|
||||||
DEVICE_ID = "98F33163"
|
DEVICE_ID = "98F33163"
|
||||||
MODULE = "homeassistant.components.lookin"
|
MODULE = "homeassistant.components.lookin"
|
||||||
@ -17,7 +17,7 @@ DEFAULT_ENTRY_TITLE = DEVICE_NAME
|
|||||||
|
|
||||||
ZC_NAME = f"LOOKin_{DEVICE_ID}"
|
ZC_NAME = f"LOOKin_{DEVICE_ID}"
|
||||||
ZC_TYPE = "_lookin._tcp."
|
ZC_TYPE = "_lookin._tcp."
|
||||||
ZEROCONF_DATA: HaServiceInfo = {
|
ZEROCONF_DATA: ZeroconfServiceInfo = {
|
||||||
"host": IP_ADDRESS,
|
"host": IP_ADDRESS,
|
||||||
"hostname": f"{ZC_NAME.lower()}.local.",
|
"hostname": f"{ZC_NAME.lower()}.local.",
|
||||||
"port": 80,
|
"port": 80,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user