mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Fix lutron caseta discovery with newer firmwares (#61029)
This commit is contained in:
parent
9f7b8d3009
commit
f5d7adc018
@ -68,7 +68,7 @@ class LutronCasetaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Handle a flow initialized by zeroconf discovery."""
|
"""Handle a flow initialized by zeroconf discovery."""
|
||||||
hostname = discovery_info.hostname
|
hostname = discovery_info.hostname
|
||||||
if hostname is None or not hostname.startswith("lutron-"):
|
if hostname is None or not hostname.lower().startswith("lutron-"):
|
||||||
return self.async_abort(reason="not_lutron_device")
|
return self.async_abort(reason="not_lutron_device")
|
||||||
|
|
||||||
self.lutron_id = hostname.split("-")[1].replace(".local.", "")
|
self.lutron_id = hostname.split("-")[1].replace(".local.", "")
|
||||||
|
@ -427,7 +427,7 @@ async def test_zeroconf_host_already_configured(hass, tmpdir):
|
|||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.ZeroconfServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
host="1.1.1.1",
|
host="1.1.1.1",
|
||||||
hostname="lutron-abc.local.",
|
hostname="LuTrOn-abc.local.",
|
||||||
name="mock_name",
|
name="mock_name",
|
||||||
port=None,
|
port=None,
|
||||||
properties={},
|
properties={},
|
||||||
@ -454,7 +454,7 @@ async def test_zeroconf_lutron_id_already_configured(hass):
|
|||||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||||
data=zeroconf.ZeroconfServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
host="1.1.1.1",
|
host="1.1.1.1",
|
||||||
hostname="lutron-abc.local.",
|
hostname="LuTrOn-abc.local.",
|
||||||
name="mock_name",
|
name="mock_name",
|
||||||
port=None,
|
port=None,
|
||||||
properties={},
|
properties={},
|
||||||
@ -504,7 +504,7 @@ async def test_zeroconf(hass, source, tmpdir):
|
|||||||
context={"source": source},
|
context={"source": source},
|
||||||
data=zeroconf.ZeroconfServiceInfo(
|
data=zeroconf.ZeroconfServiceInfo(
|
||||||
host="1.1.1.1",
|
host="1.1.1.1",
|
||||||
hostname="lutron-abc.local.",
|
hostname="LuTrOn-abc.local.",
|
||||||
name="mock_name",
|
name="mock_name",
|
||||||
port=None,
|
port=None,
|
||||||
properties={},
|
properties={},
|
||||||
|
@ -335,11 +335,3 @@ async def test_validate_trigger_invalid_triggers(hass, device_reg):
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert (
|
|
||||||
len(entity_ids := hass.states.async_entity_ids("persistent_notification")) == 1
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
"The following integrations and platforms could not be set up"
|
|
||||||
in hass.states.get(entity_ids[0]).attributes["message"]
|
|
||||||
)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user