From 846467e9d77037212d481fd965da7b700cdd1eb7 Mon Sep 17 00:00:00 2001 From: Pulpyyyy <32004297+Pulpyyyy@users.noreply.github.com> Date: Sun, 25 Jan 2026 21:11:27 +0100 Subject: [PATCH 1/2] Fix month condition filtering in schedule sensor Should fix, this kind of generated attr ``` Should fix, this kind of generated attr condition_text: >- Days: Mon, Tue, Wed, Thu, Fri, Sun AND Month: 11, 12, 1, 2, 3 AND Month: 11, 12, 1, 2, 3 AND Month: 11, 12, 1, 2, 3 AND Month: 11, 12, 1, 2, 3 AND Month: 11, 12, 1, 2, 3 AND Month: 11, 12, 1, 2, 3 AND Month: 11, 12, 1, 2, 3 ``` --- custom_components/schedule_state/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/schedule_state/sensor.py b/custom_components/schedule_state/sensor.py index 95e6335..0328bdb 100644 --- a/custom_components/schedule_state/sensor.py +++ b/custom_components/schedule_state/sensor.py @@ -1130,7 +1130,7 @@ def _serialize_conditions(self, conditions): # Filter time conditions with months if ( serializable_cond.get("condition") == "time" - and "month" in serializable_cond + and ("month" in serializable_cond or "weekday" in serializable_cond) ): clean_conditions.append(serializable_cond) # elif ( From 494d7c08d01e6e972869389efc462a732b984b3c Mon Sep 17 00:00:00 2001 From: Pulpyyyy <32004297+Pulpyyyy@users.noreply.github.com> Date: Sun, 25 Jan 2026 21:24:36 +0100 Subject: [PATCH 2/2] Avoid adding duplicate month conditions Prevent duplicate month conditions in the conditions list. --- custom_components/schedule_state/sensor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/schedule_state/sensor.py b/custom_components/schedule_state/sensor.py index 0328bdb..f6c22ae 100644 --- a/custom_components/schedule_state/sensor.py +++ b/custom_components/schedule_state/sensor.py @@ -933,7 +933,9 @@ async def _build_layers_for_event_unsafe(self, groups, event_idx, event, day): months = event.get("months", None) or event.get("month", None) if months is not None: month_condition = {"condition": "time", "month": months} - conditions.append(month_condition) + # Only add if not already present + if month_condition not in conditions: + conditions.append(month_condition) # Filter by weekday weekdays = self._get_weekdays_from_condition(conditions)