silent
This commit is contained in:
1 parent
41dc77ff4f
commit
7020c6aee9
17 files changed
+106
-5
No files matched your search
@@ -1,4 +1,3 @@
|
||||
from itertools import chain
|
||||
from pathlib import Path
|
||||
from typing import Any, Iterator, Tuple, Union
|
||||
|
||||
@@ -141,6 +140,7 @@ def extract_automation_inline_package_refs(
|
||||
ignore_package_name=False,
|
||||
) -> AutomationExtractedIter:
|
||||
for package_name, package_data in packages_config.items():
|
||||
logger.info(f"Loading package={package_name}:{type(package_data)} from {package_data}")
|
||||
try:
|
||||
if isinstance(package_data, IncludedYaml):
|
||||
package_mapping = package_data.to_normalized_json()
|
||||
@@ -176,11 +176,11 @@ def extract_automation_inline_package_refs(
|
||||
prefix_config_keys=prefix_config_keys,
|
||||
ignore_package_name=ignore_package_name,
|
||||
)
|
||||
else:
|
||||
elif package_data is not None:
|
||||
raise InvalidPackage(
|
||||
f"configurations.homeassistant.packages[{package_name}] must be a dictionary!"
|
||||
f"configurations.homeassistant.packages.{package_name} must be a dictionary but got {type(package_data)}!"
|
||||
)
|
||||
except Exception as err:
|
||||
except InvalidPackage as err:
|
||||
logger.error(err)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
- alias: UI 1
|
||||
description: Example
|
||||
mode: single
|
||||
trigger:
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
condition: []
|
||||
action:
|
||||
- service: counter.increment
|
||||
data: {}
|
||||
target:
|
||||
entity_id: counter.up_times
|
||||
- alias: UI 2
|
||||
description: ""
|
||||
trigger:
|
||||
- platform: sun
|
||||
event: sunrise
|
||||
offset: 0
|
||||
condition: []
|
||||
action: []
|
||||
mode: single
|
||||
@@ -0,0 +1,2 @@
|
||||
homeassistant:
|
||||
packages: !include_dir_named integrations
|
||||
@@ -0,0 +1 @@
|
||||
automation: !include ../automations.yaml
|
||||
@@ -0,0 +1 @@
|
||||
# media_player: !include_dir_list ../entities/media_players
|
||||
@@ -0,0 +1,21 @@
|
||||
- alias: UI 1
|
||||
description: Example
|
||||
mode: single
|
||||
trigger:
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
condition: []
|
||||
action:
|
||||
- service: counter.increment
|
||||
data: {}
|
||||
target:
|
||||
entity_id: counter.up_times
|
||||
- alias: UI 2
|
||||
description: ""
|
||||
trigger:
|
||||
- platform: sun
|
||||
event: sunrise
|
||||
offset: 0
|
||||
condition: []
|
||||
action: []
|
||||
mode: single
|
||||
@@ -0,0 +1,2 @@
|
||||
homeassistant:
|
||||
packages: !include_dir_named integrations
|
||||
@@ -0,0 +1 @@
|
||||
automation: !include ../automations.yaml
|
||||
@@ -0,0 +1 @@
|
||||
media_player:
|
||||
@@ -0,0 +1,21 @@
|
||||
- alias: UI 1
|
||||
description: Example
|
||||
mode: single
|
||||
trigger:
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
condition: []
|
||||
action:
|
||||
- service: counter.increment
|
||||
data: {}
|
||||
target:
|
||||
entity_id: counter.up_times
|
||||
- alias: UI 2
|
||||
description: ""
|
||||
trigger:
|
||||
- platform: sun
|
||||
event: sunrise
|
||||
offset: 0
|
||||
condition: []
|
||||
action: []
|
||||
mode: single
|
||||
@@ -0,0 +1,2 @@
|
||||
homeassistant:
|
||||
packages: !include_dir_named integrations
|
||||
@@ -0,0 +1 @@
|
||||
- platform: media
|
||||
@@ -0,0 +1 @@
|
||||
automation: !include ../automations.yaml
|
||||
@@ -0,0 +1,16 @@
|
||||
- platform: ping
|
||||
host: 192.168.0.119
|
||||
name: "Ping Pc Tv"
|
||||
scan_interval: 10
|
||||
- platform: ping
|
||||
host: 192.168.0.181
|
||||
name: "Ping Living Room Tv"
|
||||
scan_interval: 10
|
||||
- platform: ping
|
||||
host: 192.168.0.100
|
||||
name: "Ping Printer"
|
||||
scan_interval: 15
|
||||
- platform: ping
|
||||
host: 192.168.0.177
|
||||
name: "Ping Broadlink"
|
||||
scan_interval: 15
|
||||
@@ -0,0 +1 @@
|
||||
media_player: !include_dir_list ../entities/media_players
|
||||
@@ -10,7 +10,6 @@ from src.automations.tags import TagManager
|
||||
from src.automations.types import ExtenededAutomation
|
||||
from src.hass_config.loader import HassConfig
|
||||
from tests.utils import (
|
||||
HA_CONFIG14_EXAMPLE,
|
||||
HA_CONFIG2_EXAMPLE,
|
||||
HA_CONFIG3_EXAMPLE,
|
||||
HA_CONFIG4_EXAMPLE,
|
||||
@@ -23,6 +22,10 @@ from tests.utils import (
|
||||
HA_CONFIG11_EXAMPLE,
|
||||
HA_CONFIG12_EXAMPLE,
|
||||
HA_CONFIG13_EXAMPLE,
|
||||
HA_CONFIG14_EXAMPLE,
|
||||
HA_CONFIG15_EXAMPLE,
|
||||
HA_CONFIG16_EXAMPLE,
|
||||
HA_CONFIG17_EXAMPLE,
|
||||
HA_CONFIG_EXAMPLE,
|
||||
)
|
||||
|
||||
@@ -164,6 +167,9 @@ class loader_tests(TestCase):
|
||||
(HA_CONFIG12_EXAMPLE, 4),
|
||||
(HA_CONFIG13_EXAMPLE, 4),
|
||||
(HA_CONFIG14_EXAMPLE, 1),
|
||||
(HA_CONFIG15_EXAMPLE, 1),
|
||||
(HA_CONFIG16_EXAMPLE, 1),
|
||||
(HA_CONFIG17_EXAMPLE, 1),
|
||||
]:
|
||||
with self.subTest(config_name=ha_path.name, expected=expected):
|
||||
hass_config = HassConfig(ha_path)
|
||||
|
||||
@@ -24,6 +24,9 @@ HA_CONFIG11_EXAMPLE = SAMPLES_FOLDER / "config-11"
|
||||
HA_CONFIG12_EXAMPLE = SAMPLES_FOLDER / "config-12"
|
||||
HA_CONFIG13_EXAMPLE = SAMPLES_FOLDER / "config-13"
|
||||
HA_CONFIG14_EXAMPLE = SAMPLES_FOLDER / "config-14"
|
||||
HA_CONFIG15_EXAMPLE = SAMPLES_FOLDER / "config-15"
|
||||
HA_CONFIG16_EXAMPLE = SAMPLES_FOLDER / "config-16"
|
||||
HA_CONFIG17_EXAMPLE = SAMPLES_FOLDER / "config-17"
|
||||
|
||||
|
||||
def get_example_automation_loader(
|
||||
|
||||
Reference in new issue
Block a user