Home Assistant Unofficial Reference 2024.12.1
common.py
Go to the documentation of this file.
1 """Common classes and elements for Omnilogic Integration."""
2 
3 
4 def check_guard(state_key, item, entity_setting):
5  """Validate that this entity passes the defined guard conditions defined at setup."""
6 
7  if state_key not in item:
8  return True
9 
10  for guard_condition in entity_setting["guard_condition"]:
11  if guard_condition and all(
12  item.get(guard_key) == guard_value
13  for guard_key, guard_value in guard_condition.items()
14  ):
15  return True
16 
17  return False
def check_guard(state_key, item, entity_setting)
Definition: common.py:4