diff --git a/custom_components/watchman/__init__.py b/custom_components/watchman/__init__.py index 3901115..e35c57e 100644 --- a/custom_components/watchman/__init__.py +++ b/custom_components/watchman/__init__.py @@ -6,7 +6,6 @@ from dataclasses import dataclass from typing import Any import voluptuous as vol -from anyio import Path from homeassistant.helpers import config_validation as cv from homeassistant.components import persistent_notification from homeassistant.util import dt as dt_util diff --git a/custom_components/watchman/const.py b/custom_components/watchman/const.py index 6a849ba..ddf62fd 100644 --- a/custom_components/watchman/const.py +++ b/custom_components/watchman/const.py @@ -117,3 +117,26 @@ CONF_FRIENDLY_NAMES: False, }, } + +# additional domains to detect entities which are not included into +# homeassistant.const.Platform enum +DEFAULT_HA_DOMAINS = [ + "group", + "input_boolean", + "input_select", + "input_text", + "script", + "alert", + "automation", + "counter", + "input_datetime", + "input_number", + "input_button", + "person", + "plant", + "proximity", + "sun", + "timer", + "zone", + "schedule", +] diff --git a/custom_components/watchman/utils/utils.py b/custom_components/watchman/utils/utils.py index b95c507..3c9ff54 100644 --- a/custom_components/watchman/utils/utils.py +++ b/custom_components/watchman/utils/utils.py @@ -1,6 +1,5 @@ """Miscellaneous support functions for watchman""" -from venv import logger import anyio import re import fnmatch @@ -17,26 +16,6 @@ from homeassistant.core import HomeAssistant from homeassistant.config_entries import ConfigEntry -DEFAULT_DOMAINS = [ - "group", - "input_boolean", - "input_select", - "input_text", - "script", - "alert", - "automation", - "counter", - "input_datetime", - "input_number", - "input_button", - "person", - "plant", - "proximity", - "sun", - "timer", - "zone", - "schedule", -] from .logger import _LOGGER, INDENT from ..const import ( @@ -67,6 +46,7 @@ REPORT_ENTRY_TYPE_ENTITY, REPORT_ENTRY_TYPE_SERVICE, DEFAULT_OPTIONS, + DEFAULT_HA_DOMAINS, ) @@ -320,7 +300,7 @@ async def parse(hass, folders, ignored_files, root=None): parsed_files_count = 0 entity_pattern = re.compile( r"(?:(?<=\s)|(?<=^)|(?<=\")|(?<=\'))([A-Za-z_0-9]*\s*:)?(?:\s*)?(?:states.)?" - rf"(({ "|".join([*Platform, *DEFAULT_DOMAINS]) })\.[A-Za-z_*0-9]+)" + rf"(({ "|".join([*Platform, *DEFAULT_HA_DOMAINS]) })\.[A-Za-z_*0-9]+)" ) service_pattern = re.compile( r"(?:service|action):\s*([A-Za-z_0-9]*\.[A-Za-z_0-9]+)"