Skip to content

Commit

Permalink
Remove incorrect device check in LCN events (#134116)
Browse files Browse the repository at this point in the history
  • Loading branch information
alengwenus authored Dec 28, 2024
1 parent 28cd7f2 commit 565fa4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
12 changes: 8 additions & 4 deletions homeassistant/components/lcn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 = {
Expand All @@ -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):
Expand Down
16 changes: 0 additions & 16 deletions tests/components/lcn/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 565fa4e

Please sign in to comment.