-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
29 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Backports for lock_code_manager.""" | ||
|
||
from __future__ import annotations | ||
|
||
import logging | ||
from typing import Any | ||
|
||
from homeassistant.const import MAJOR_VERSION, MINOR_VERSION | ||
from homeassistant.core import Event | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
EVENT_DATA_PASSED_IN = MAJOR_VERSION > 2024 or ( | ||
MAJOR_VERSION == 2024 and MINOR_VERSION >= 4 | ||
) | ||
|
||
|
||
def get_event_data_for_filter(evt: Event | dict[str, Any]) -> dict[str, Any]: | ||
"""Get event data for filter.""" | ||
return evt if EVENT_DATA_PASSED_IN else evt.data # type: ignore[union-attr] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters