Skip to content

Commit

Permalink
Update event_filter breaking change [fixes #79]
Browse files Browse the repository at this point in the history
  • Loading branch information
jhansche committed Apr 6, 2024
1 parent b734efd commit 04aafc5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions custom_components/birdbuddy/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ async def async_added_to_hass(self) -> None:

@callback
def filter_my_postcards(event: Event) -> bool:
return self.feeder.id == event.data.get("sighting", {}).get(
"feeder", {}
).get("id")
# FIXME: This signature changed in 2024.4
data = event if callable(getattr(event, "get", None)) else event.data
return self.feeder.id == (
data.get("sighting", {}).get("feeder", {}).get("id")
)

self.async_on_remove(
self.hass.bus.async_listen(
Expand Down

0 comments on commit 04aafc5

Please sign in to comment.