Skip to content

Commit

Permalink
added predefined set of ignored_items
Browse files Browse the repository at this point in the history
  • Loading branch information
dummylabs committed Feb 8, 2022
1 parent 75440b5 commit eb9b899
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions custom_components/watchman/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@
"timer",
"zone",
]

BUNDLED_IGNORED_ITEMS = [
"timer.cancelled",
"timer.finished",
"timer.started",
"timer.restarted",
"timer.paused",
]
3 changes: 3 additions & 0 deletions custom_components/watchman/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
CONF_SEND_NITIFICATION,
CONF_COLUMNS_WIDTH,
CONF_FRIENDLY_NAMES,
BUNDLED_IGNORED_ITEMS,
)

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -153,6 +154,7 @@ def get_entity_state(hass, entry, friendly_names=False):
def check_services(hass, config):
"""check if entries from config file are services"""
ignored_items = config[DOMAIN].get(CONF_IGNORED_ITEMS, [])
ignored_items = list(set(ignored_items + BUNDLED_IGNORED_ITEMS))
if DOMAIN not in hass.data or "service_list" not in hass.data[DOMAIN]:
raise HomeAssistantError("Service list not found")
service_list = hass.data[DOMAIN]["service_list"]
Expand All @@ -175,6 +177,7 @@ def check_entitites(hass, config):
"""check if entries from config file are entities with an active state"""
ignored_states = config[DOMAIN].get(CONF_IGNORED_STATES, [])
ignored_items = config[DOMAIN].get(CONF_IGNORED_ITEMS, [])
ignored_items = list(set(ignored_items + BUNDLED_IGNORED_ITEMS))
if DOMAIN not in hass.data or "entity_list" not in hass.data[DOMAIN]:
_LOGGER.error("Entity list not found")
raise Exception("Entity list not found")
Expand Down

0 comments on commit eb9b899

Please sign in to comment.