Skip to content

Commit

Permalink
fix: imports
Browse files Browse the repository at this point in the history
  • Loading branch information
dummylabs committed Nov 25, 2024
1 parent 9267d1b commit a829d5d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
1 change: 0 additions & 1 deletion custom_components/watchman/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions custom_components/watchman/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
24 changes: 2 additions & 22 deletions custom_components/watchman/utils/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Miscellaneous support functions for watchman"""

from venv import logger
import anyio
import re
import fnmatch
Expand All @@ -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 (
Expand Down Expand Up @@ -67,6 +46,7 @@
REPORT_ENTRY_TYPE_ENTITY,
REPORT_ENTRY_TYPE_SERVICE,
DEFAULT_OPTIONS,
DEFAULT_HA_DOMAINS,
)


Expand Down Expand Up @@ -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]+)"
Expand Down

0 comments on commit a829d5d

Please sign in to comment.