Fix lutron caseta discovery with newer firmwares (#61029)

This commit is contained in:
J. Nick Koston 2021-12-05 06:09:18 -10:00 committed by GitHub
parent 9f7b8d3009
commit f5d7adc018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 12 deletions

View File

@ -68,7 +68,7 @@ class LutronCasetaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
) -> FlowResult:
"""Handle a flow initialized by zeroconf discovery."""
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")
self.lutron_id = hostname.split("-")[1].replace(".local.", "")

View File

@ -427,7 +427,7 @@ async def test_zeroconf_host_already_configured(hass, tmpdir):
context={"source": config_entries.SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
host="1.1.1.1",
hostname="lutron-abc.local.",
hostname="LuTrOn-abc.local.",
name="mock_name",
port=None,
properties={},
@ -454,7 +454,7 @@ async def test_zeroconf_lutron_id_already_configured(hass):
context={"source": config_entries.SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
host="1.1.1.1",
hostname="lutron-abc.local.",
hostname="LuTrOn-abc.local.",
name="mock_name",
port=None,
properties={},
@ -504,7 +504,7 @@ async def test_zeroconf(hass, source, tmpdir):
context={"source": source},
data=zeroconf.ZeroconfServiceInfo(
host="1.1.1.1",
hostname="lutron-abc.local.",
hostname="LuTrOn-abc.local.",
name="mock_name",
port=None,
properties={},

View File

@ -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"]
)