From e26d4d6633f2ee76d34c026308e7f6f6ac4c6d41 Mon Sep 17 00:00:00 2001 From: Phil Bruckner Date: Tue, 16 Jan 2024 10:35:43 -0600 Subject: [PATCH] Make trackers config required and length must be at least one --- custom_components/composite/__init__.py | 4 ++-- custom_components/composite/device_tracker.py | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/custom_components/composite/__init__.py b/custom_components/composite/__init__.py index 4371fa4..b00baaa 100644 --- a/custom_components/composite/__init__.py +++ b/custom_components/composite/__init__.py @@ -157,8 +157,8 @@ def _defaults(config: dict) -> dict: ): cv.boolean, } ), - vol.Optional(CONF_TRACKERS, default=list): vol.All( - cv.ensure_list, [_TRACKER], _tracker_ids + vol.Required(CONF_TRACKERS, default=list): vol.All( + cv.ensure_list, vol.Length(1), [_TRACKER], _tracker_ids ), } ), diff --git a/custom_components/composite/device_tracker.py b/custom_components/composite/device_tracker.py index 40a21fa..6845f5d 100644 --- a/custom_components/composite/device_tracker.py +++ b/custom_components/composite/device_tracker.py @@ -146,12 +146,7 @@ def set_params(self, use_all_states: bool, use_picture: bool) -> None: self.use_all_states = use_all_states self.use_picture = use_picture - def good( - self, - seen: datetime, - source_type: str, - data: Location | str, - ) -> None: + def good(self, seen: datetime, source_type: str, data: Location | str) -> None: """Mark entity as good.""" self.status = EntityStatus.ACTIVE self.seen = seen