mirror of
https://github.com/home-assistant/core.git
synced 2026-07-02 04:06:41 +01:00
0ed8d24b54
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
18 lines
494 B
Python
18 lines
494 B
Python
"""Common classes and elements for Omnilogic Integration."""
|
|
|
|
|
|
def check_guard(state_key, item, entity_setting):
|
|
"""Validate that this entity passes the guard conditions."""
|
|
|
|
if state_key not in item:
|
|
return True
|
|
|
|
for guard_condition in entity_setting["guard_condition"]:
|
|
if guard_condition and all(
|
|
item.get(guard_key) == guard_value
|
|
for guard_key, guard_value in guard_condition.items()
|
|
):
|
|
return True
|
|
|
|
return False
|