Remove incorrect device check in LCN events (#134116)

pull/134130/head
Andre Lengwenus 2024-12-28 09:26:49 +01:00 committed by GitHub
parent 28cd7f2473
commit 565fa4ea1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 20 deletions

View File

@ -230,8 +230,6 @@ def async_host_input_received(
)
identifiers = {(DOMAIN, generate_unique_id(config_entry.entry_id, address))}
device = device_registry.async_get_device(identifiers=identifiers)
if device is None:
return
if isinstance(inp, pypck.inputs.ModStatusAccessControl):
_async_fire_access_control_event(hass, device, address, inp)
@ -240,7 +238,10 @@ def async_host_input_received(
def _async_fire_access_control_event(
hass: HomeAssistant, device: dr.DeviceEntry, address: AddressType, inp: InputType
hass: HomeAssistant,
device: dr.DeviceEntry | None,
address: AddressType,
inp: InputType,
) -> None:
"""Fire access control event (transponder, transmitter, fingerprint, codelock)."""
event_data = {
@ -262,7 +263,10 @@ def _async_fire_access_control_event(
def _async_fire_send_keys_event(
hass: HomeAssistant, device: dr.DeviceEntry, address: AddressType, inp: InputType
hass: HomeAssistant,
device: dr.DeviceEntry | None,
address: AddressType,
inp: InputType,
) -> None:
"""Fire send_keys event."""
for table, action in enumerate(inp.actions):

View File

@ -150,19 +150,3 @@ async def test_dont_fire_on_non_module_input(
await lcn_connection.async_process_input(inp)
await hass.async_block_till_done()
assert len(events) == 0
async def test_dont_fire_on_unknown_module(
hass: HomeAssistant, entry: MockConfigEntry
) -> None:
"""Test for no event is fired if an input from an unknown module is received."""
lcn_connection = await init_integration(hass, entry)
inp = ModStatusAccessControl(
LcnAddr(0, 10, False), # unknown module
periphery=AccessControlPeriphery.FINGERPRINT,
code="aabbcc",
)
events = async_capture_events(hass, LCN_FINGERPRINT)
await lcn_connection.async_process_input(inp)
await hass.async_block_till_done()
assert len(events) == 0