From 94589f52d7f39b7b96215649a4f24ff5dff85d7f Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 13 Jan 2026 12:52:49 +0100 Subject: [PATCH 1/8] initial --- apps/abstraction/transformation.py | 2 ++ config/rules.yaml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/abstraction/transformation.py b/apps/abstraction/transformation.py index dd220e2..62c91bf 100644 --- a/apps/abstraction/transformation.py +++ b/apps/abstraction/transformation.py @@ -15,6 +15,7 @@ from apps.abstraction.vendors import ( simulator, zigbee2mqtt, max, + test, shelly, tasmota, hottis_pv_modbus, @@ -40,6 +41,7 @@ for vendor_name, vendor_module in [ ("simulator", simulator), ("zigbee2mqtt", zigbee2mqtt), ("max", max), + ("test", test), ("shelly", shelly), ("tasmota", tasmota), ("hottis_pv_modbus", hottis_pv_modbus), diff --git a/config/rules.yaml b/config/rules.yaml index 5594e95..54a95ef 100644 --- a/config/rules.yaml +++ b/config/rules.yaml @@ -9,7 +9,7 @@ rules: thermostats: - thermostat_bad_unten params: - eco_target: 16.0 + eco_target: 6.0 open_min_secs: 20 close_min_secs: 20 - id: window_setback_esszimmer @@ -23,7 +23,7 @@ rules: thermostats: - thermostat_esszimmer params: - eco_target: 16.0 + eco_target: 6.0 open_min_secs: 20 close_min_secs: 20 previous_target_ttl_secs: 86400 @@ -38,7 +38,7 @@ rules: thermostats: - thermostat_wohnzimmer params: - eco_target: 16.0 + eco_target: 6.0 open_min_secs: 20 close_min_secs: 20 previous_target_ttl_secs: 86400 @@ -55,7 +55,7 @@ rules: thermostats: - thermostat_kueche params: - eco_target: 16.0 + eco_target: 6.0 open_min_secs: 20 close_min_secs: 20 previous_target_ttl_secs: 86400 @@ -71,7 +71,7 @@ rules: thermostats: - thermostat_patty params: - eco_target: 16.0 + eco_target: 6.0 open_min_secs: 20 close_min_secs: 20 previous_target_ttl_secs: 86400 @@ -85,7 +85,7 @@ rules: thermostats: - thermostat_schlafzimmer params: - eco_target: 16.0 + eco_target: 6.0 open_min_secs: 20 close_min_secs: 20 previous_target_ttl_secs: 86400 @@ -99,7 +99,7 @@ rules: thermostats: - thermostat_wolfgang params: - eco_target: 16.0 + eco_target: 6.0 open_min_secs: 20 close_min_secs: 20 - id: window_setback_bad_oben @@ -112,6 +112,6 @@ rules: thermostats: - thermostat_bad_oben params: - eco_target: 16.0 + eco_target: 6.0 open_min_secs: 20 close_min_secs: 20 From 4f5bcd7dbf920be611dd24a26194e77032281d6b Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 13 Jan 2026 13:04:04 +0100 Subject: [PATCH 2/8] test devices --- config/devices.yaml | 35 ++++++++++++++++++++++++++++++++++ config/rules.yaml | 46 ++++++++++++++------------------------------- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/config/devices.yaml b/config/devices.yaml index 47c18bf..cf924ff 100644 --- a/config/devices.yaml +++ b/config/devices.yaml @@ -1152,3 +1152,38 @@ devices: topics: state: "zigbee2mqtt/0x842e14fffefe4ba4" set: "zigbee2mqtt/0x842e14fffefe4ba4/set" + +- device_id: kontakt_test_1 + homekit_aid: 97 + name: Kontakt Test 1 + type: contact + cap_version: contact_sensor@1.0.0 + technology: test + topics: + state: test/kontakt1/state + features: {} +- device_id: kontakt_test_2 + homekit_aid: 98 + name: Kontakt Test 2 + type: contact + cap_version: contact_sensor@1.0.0 + technology: test + topics: + state: test/kontakt2/state + features: {} +- device_id: thermostat_test + homekit_aid: 99 + name: Thermostat Test + type: thermostat + cap_version: "thermostat@1.0.0" + technology: test + features: + heating: true + temperature_range: + - 5 + - 30 + temperature_step: 0.5 + topics: + state: "test/thermostat1/state" + set: "test/thermostat1/set" + \ No newline at end of file diff --git a/config/rules.yaml b/config/rules.yaml index 9cdc7c2..e9a21ce 100644 --- a/config/rules.yaml +++ b/config/rules.yaml @@ -9,11 +9,7 @@ rules: thermostats: - thermostat_bad_unten params: -<<<<<<< HEAD - eco_target: 6.0 -======= eco_target: 5.0 ->>>>>>> main open_min_secs: 20 close_min_secs: 20 - id: window_setback_esszimmer @@ -27,11 +23,7 @@ rules: thermostats: - thermostat_esszimmer params: -<<<<<<< HEAD - eco_target: 6.0 -======= eco_target: 5.0 ->>>>>>> main open_min_secs: 20 close_min_secs: 20 previous_target_ttl_secs: 86400 @@ -46,11 +38,7 @@ rules: thermostats: - thermostat_wohnzimmer params: -<<<<<<< HEAD - eco_target: 6.0 -======= eco_target: 5.0 ->>>>>>> main open_min_secs: 20 close_min_secs: 20 previous_target_ttl_secs: 86400 @@ -67,11 +55,7 @@ rules: thermostats: - thermostat_kueche params: -<<<<<<< HEAD - eco_target: 6.0 -======= eco_target: 5.0 ->>>>>>> main open_min_secs: 20 close_min_secs: 20 previous_target_ttl_secs: 86400 @@ -87,11 +71,7 @@ rules: thermostats: - thermostat_patty params: -<<<<<<< HEAD - eco_target: 6.0 -======= eco_target: 5.0 ->>>>>>> main open_min_secs: 20 close_min_secs: 20 previous_target_ttl_secs: 86400 @@ -105,11 +85,7 @@ rules: thermostats: - thermostat_schlafzimmer params: -<<<<<<< HEAD - eco_target: 6.0 -======= eco_target: 5.0 ->>>>>>> main open_min_secs: 20 close_min_secs: 20 previous_target_ttl_secs: 86400 @@ -123,11 +99,7 @@ rules: thermostats: - thermostat_wolfgang params: -<<<<<<< HEAD - eco_target: 6.0 -======= eco_target: 5.0 ->>>>>>> main open_min_secs: 20 close_min_secs: 20 - id: window_setback_bad_oben @@ -140,10 +112,20 @@ rules: thermostats: - thermostat_bad_oben params: -<<<<<<< HEAD - eco_target: 6.0 -======= eco_target: 5.0 ->>>>>>> main + open_min_secs: 20 + close_min_secs: 20 +- id: window_setback_test + enabled: true + name: Fensterabsenkung Test + type: window_setback@1.0 + objects: + contacts: + - kontakt_test_1 + - kontakt_test_2 + thermostats: + - thermostat_test + params: + eco_target: 7.0 open_min_secs: 20 close_min_secs: 20 From 38762d60f2791605634cd11bfbb6d0cbaf696f01 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 13 Jan 2026 15:25:18 +0100 Subject: [PATCH 3/8] fix window setback logic for multiple windows --- apps/rules/impl/window_setback.py | 65 +++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/apps/rules/impl/window_setback.py b/apps/rules/impl/window_setback.py index 0f29cf1..83ef87a 100644 --- a/apps/rules/impl/window_setback.py +++ b/apps/rules/impl/window_setback.py @@ -18,6 +18,19 @@ class WindowSetbackObjects(BaseModel): thermostats: list[str] = Field(..., min_length=1, description="Thermostats to control") +def __get_redis_key_current_target(rule_id: str, thermo_id: str) -> str: + """Get Redis key for current target temperature of a thermostat""" + return f"rule:{rule_id}:thermo:{thermo_id}:current_target" +def __get_redis_key_previous_target(rule_id: str, thermo_id: str) -> str: + """Get Redis key for previous target temperature of a thermostat""" + return f"rule:{rule_id}:thermo:{thermo_id}:previous" +def __get_redis_key_contact_state(rule_id: str, contact_id: str) -> str: + """Get Redis key for contact sensor state""" + return f"rule:{rule_id}:contact:{contact_id}:is_open" +def __get_redis_key_rule_state(rule_id: str) -> str: + """Get Redis key for overall rule state""" + return f"rule:{rule_id}:state" + class WindowSetbackRule(Rule): """ Window setback automation rule. @@ -31,16 +44,14 @@ class WindowSetbackRule(Rule): thermostats: List of thermostat device IDs to control (required, min 1) params: eco_target: Temperature to set when window opens (default: 16.0) - open_min_secs: Minimum seconds window must be open before triggering (default: 20) - close_min_secs: Minimum seconds window must be closed before restoring (default: 20) previous_target_ttl_secs: How long to remember previous temperature (default: 86400) State storage (Redis keys): - rule:{rule_id}:contact:{device_id}:state -> "open" | "closed" - rule:{rule_id}:contact:{device_id}:ts -> ISO timestamp of last change rule:{rule_id}:thermo:{device_id}:current_target -> Current target temp (updated on every STATE) rule:{rule_id}:thermo:{device_id}:previous -> Previous target temp (saved on window open, deleted on restore) - + rule:{rule_id}:contact:{device_id}:is_open -> "1" if open, "0" if closed + rule:{rule_id}:state -> Overall rule state -> "1" if thermostats set to eco, "0" otherwise + Logic: 1. Thermostat STATE events → update current_target in Redis 2. Window opens → copy current_target to previous, then set to eco_target @@ -129,18 +140,30 @@ class WindowSetbackRule(Rule): if not contact_state: ctx.logger.warning(f"Contact event missing 'contact' field: {evt}") return - - # Store current state and timestamp - state_key = f"rule:{desc.id}:contact:{device_id}:state" - ts_key = f"rule:{desc.id}:contact:{device_id}:ts" - - await ctx.redis.set(state_key, contact_state) - await ctx.redis.set(ts_key, event_ts) - - if contact_state == 'open': - await self._on_window_opened(desc, ctx) - elif contact_state == 'closed': - await self._on_window_closed(desc, ctx) + + contact_state_key = __get_redis_key_contact_state(desc.id, device_id) + await ctx.redis.set(contact_state_key, '1' if contact_state == 'open' else '0') + + # Check if any contact is open + is_open = False + for contact_id in desc.objects.get('contacts', []): + state_key = __get_redis_key_contact_state(desc.id, contact_id) + state_val = await ctx.redis.get(state_key) + if state_val == '1': + is_open = True + break + + rule_state_key = __get_redis_key_rule_state(desc.id) + current_rule_state = await ctx.redis.get(rule_state_key) + if is_open and current_rule_state != '1': + # At least one contact is open, and we are not already in eco mode + await self._set_eco_mode(desc, ctx) + await ctx.redis.set(rule_state_key, '1') + elif not is_open and current_rule_state != '0': + # All contacts are closed, and we are currently in eco mode + await self._unset_eco_mode(desc, ctx) + await ctx.redis.set(rule_state_key, '0') + async def _on_window_opened(self, desc: RuleDescriptor, ctx: RuleContext) -> None: """ @@ -160,12 +183,12 @@ class WindowSetbackRule(Rule): # FIRST: Save current target temperatures as "previous" (before we change them!) for thermo_id in target_thermostats: - current_key = f"rule:{desc.id}:thermo:{thermo_id}:current_target" + current_key = __get_redis_key_current_target(desc.id, thermo_id) current_temp_str = await ctx.redis.get(current_key) if current_temp_str: # Save current as previous (with TTL) - prev_key = f"rule:{desc.id}:thermo:{thermo_id}:previous" + prev_key = __get_redis_key_previous_target(desc.id, thermo_id) await ctx.redis.set(prev_key, current_temp_str, ttl_secs=ttl_secs) ctx.logger.debug( f"Saved previous target for {thermo_id}: {current_temp_str}°C" @@ -199,7 +222,7 @@ class WindowSetbackRule(Rule): # Restore previous temperatures for thermo_id in target_thermostats: - prev_key = f"rule:{desc.id}:thermo:{thermo_id}:previous" + prev_key = __get_redis_key_previous_target(desc.id, thermo_id) prev_temp_str = await ctx.redis.get(prev_key) if prev_temp_str: @@ -240,7 +263,7 @@ class WindowSetbackRule(Rule): return # No target in this state update # Store current target (always update, even if it's the eco temperature) - current_key = f"rule:{desc.id}:thermo:{device_id}:current_target" + current_key = __get_redis_key_current_target(desc.id, device_id) ttl_secs = desc.params.get('previous_target_ttl_secs', 86400) await ctx.redis.set(current_key, str(current_target), ttl_secs=ttl_secs) From 55937d59007e0dd994e0e6758cc57f2f9424527c Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 13 Jan 2026 15:33:57 +0100 Subject: [PATCH 4/8] fix window setback logic for multiple windows, fix 1 --- apps/rules/impl/window_setback.py | 74 +++++++++++++++---------------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/apps/rules/impl/window_setback.py b/apps/rules/impl/window_setback.py index 83ef87a..6532c5e 100644 --- a/apps/rules/impl/window_setback.py +++ b/apps/rules/impl/window_setback.py @@ -18,18 +18,6 @@ class WindowSetbackObjects(BaseModel): thermostats: list[str] = Field(..., min_length=1, description="Thermostats to control") -def __get_redis_key_current_target(rule_id: str, thermo_id: str) -> str: - """Get Redis key for current target temperature of a thermostat""" - return f"rule:{rule_id}:thermo:{thermo_id}:current_target" -def __get_redis_key_previous_target(rule_id: str, thermo_id: str) -> str: - """Get Redis key for previous target temperature of a thermostat""" - return f"rule:{rule_id}:thermo:{thermo_id}:previous" -def __get_redis_key_contact_state(rule_id: str, contact_id: str) -> str: - """Get Redis key for contact sensor state""" - return f"rule:{rule_id}:contact:{contact_id}:is_open" -def __get_redis_key_rule_state(rule_id: str) -> str: - """Get Redis key for overall rule state""" - return f"rule:{rule_id}:state" class WindowSetbackRule(Rule): """ @@ -57,7 +45,24 @@ class WindowSetbackRule(Rule): 2. Window opens → copy current_target to previous, then set to eco_target 3. Window closes → restore from previous, then delete previous key """ - + + @staticmethod + def __get_redis_key_current_target(rule_id: str, thermo_id: str) -> str: + """Get Redis key for current target temperature of a thermostat""" + return f"rule:{rule_id}:thermo:{thermo_id}:current_target" + @staticmethod + def __get_redis_key_previous_target(rule_id: str, thermo_id: str) -> str: + """Get Redis key for previous target temperature of a thermostat""" + return f"rule:{rule_id}:thermo:{thermo_id}:previous" + @staticmethod + def __get_redis_key_contact_state(rule_id: str, contact_id: str) -> str: + """Get Redis key for contact sensor state""" + return f"rule:{rule_id}:contact:{contact_id}:is_open" + @staticmethod + def __get_redis_key_rule_state(rule_id: str) -> str: + """Get Redis key for overall rule state""" + return f"rule:{rule_id}:state" + def __init__(self): super().__init__() self._validated_objects: dict[str, WindowSetbackObjects] = {} @@ -141,19 +146,19 @@ class WindowSetbackRule(Rule): ctx.logger.warning(f"Contact event missing 'contact' field: {evt}") return - contact_state_key = __get_redis_key_contact_state(desc.id, device_id) + contact_state_key = WindowSetbackRule.__get_redis_key_contact_state(desc.id, device_id) await ctx.redis.set(contact_state_key, '1' if contact_state == 'open' else '0') # Check if any contact is open is_open = False for contact_id in desc.objects.get('contacts', []): - state_key = __get_redis_key_contact_state(desc.id, contact_id) + state_key = WindowSetbackRule.__get_redis_key_contact_state(desc.id, contact_id) state_val = await ctx.redis.get(state_key) if state_val == '1': is_open = True break - rule_state_key = __get_redis_key_rule_state(desc.id) + rule_state_key = WindowSetbackRule.__get_redis_key_rule_state(desc.id) current_rule_state = await ctx.redis.get(rule_state_key) if is_open and current_rule_state != '1': # At least one contact is open, and we are not already in eco mode @@ -164,31 +169,26 @@ class WindowSetbackRule(Rule): await self._unset_eco_mode(desc, ctx) await ctx.redis.set(rule_state_key, '0') - - async def _on_window_opened(self, desc: RuleDescriptor, ctx: RuleContext) -> None: - """ - Window opened - save current temperatures, then set thermostats to eco. - - Important: We must save the current target BEFORE setting to eco, - otherwise we'll save the eco temperature instead of the original. - """ - eco_target = desc.params.get('eco_target', 16.0) + + async def _set_eco_mode(self, desc: RuleDescriptor, ctx: RuleContext) -> None: + """Set thermostats to eco temperature when window opens.""" + eco_target = desc.params.get('eco_target', 7.0) target_thermostats = desc.objects.get('thermostats', []) ttl_secs = desc.params.get('previous_target_ttl_secs', 86400) ctx.logger.info( - f"Rule {desc.id}: Window opened, setting {len(target_thermostats)} " + f"Rule {desc.id}: At least one window is opened, setting {len(target_thermostats)} " f"thermostats to eco temperature {eco_target}°C" ) # FIRST: Save current target temperatures as "previous" (before we change them!) for thermo_id in target_thermostats: - current_key = __get_redis_key_current_target(desc.id, thermo_id) + current_key = WindowSetbackRule.__get_redis_key_current_target(desc.id, thermo_id) current_temp_str = await ctx.redis.get(current_key) if current_temp_str: # Save current as previous (with TTL) - prev_key = __get_redis_key_previous_target(desc.id, thermo_id) + prev_key = WindowSetbackRule.__get_redis_key_previous_target(desc.id, thermo_id) await ctx.redis.set(prev_key, current_temp_str, ttl_secs=ttl_secs) ctx.logger.debug( f"Saved previous target for {thermo_id}: {current_temp_str}°C" @@ -205,24 +205,20 @@ class WindowSetbackRule(Rule): ctx.logger.debug(f"Set {thermo_id} to {eco_target}°C") except Exception as e: ctx.logger.error(f"Failed to set {thermo_id}: {e}") - - async def _on_window_closed(self, desc: RuleDescriptor, ctx: RuleContext) -> None: - """ - Window closed - restore previous temperatures. - - Note: This is simplified. A production implementation would check - close_min_secs and use a timer/scheduler. - """ + + + async def _unset_eco_mode(self, desc: RuleDescriptor, ctx: RuleContext) -> None: + """Restore thermostats to previous temperature when window closes.""" target_thermostats = desc.objects.get('thermostats', []) ctx.logger.info( - f"Rule {desc.id}: Window closed, restoring {len(target_thermostats)} " + f"Rule {desc.id}: All windows closed, restoring {len(target_thermostats)} " f"thermostats to previous temperatures" ) # Restore previous temperatures for thermo_id in target_thermostats: - prev_key = __get_redis_key_previous_target(desc.id, thermo_id) + prev_key = WindowSetbackRule.__get_redis_key_previous_target(desc.id, thermo_id) prev_temp_str = await ctx.redis.get(prev_key) if prev_temp_str: @@ -263,7 +259,7 @@ class WindowSetbackRule(Rule): return # No target in this state update # Store current target (always update, even if it's the eco temperature) - current_key = __get_redis_key_current_target(desc.id, device_id) + current_key = WindowSetbackRule.__get_redis_key_current_target(desc.id, device_id) ttl_secs = desc.params.get('previous_target_ttl_secs', 86400) await ctx.redis.set(current_key, str(current_target), ttl_secs=ttl_secs) From 6eea13661e19f1f17b9178196ac4948f777818d6 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 13 Jan 2026 16:07:05 +0100 Subject: [PATCH 5/8] fix window setback logic for multiple windows, fix 2 --- apps/rules/impl/window_setback.py | 42 ++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/apps/rules/impl/window_setback.py b/apps/rules/impl/window_setback.py index 6532c5e..cbd5e5c 100644 --- a/apps/rules/impl/window_setback.py +++ b/apps/rules/impl/window_setback.py @@ -62,6 +62,24 @@ class WindowSetbackRule(Rule): def __get_redis_key_rule_state(rule_id: str) -> str: """Get Redis key for overall rule state""" return f"rule:{rule_id}:state" + @staticmethod + async def __redis_get(ctx: RuleContext, key: str) -> Any: + """Helper to get value from Redis""" + v = await ctx.redis.get(key) + ctx.logger.debug(f"Redis GET {key} -> {v}") + return v + @staticmethod + async def __redis_set(ctx: RuleContext, key: str, value: Any) -> None: + """Helper to set value in Redis""" + ctx.logger.debug(f"Redis SET {key} = {value}") + await ctx.redis.set(key, value) + @staticmethod + async def __redis_delete(ctx: RuleContext, key: str) -> None: + """Helper to delete key from Redis""" + ctx.logger.debug(f"Redis DEL {key}") + await ctx.redis.delete(key) + + def __init__(self): super().__init__() @@ -140,41 +158,39 @@ class WindowSetbackRule(Rule): """Handle contact sensor state change.""" device_id = evt['device_id'] contact_state = evt['payload'].get('contact') # "open" or "closed" - event_ts = evt.get('ts', ctx.now().isoformat()) if not contact_state: ctx.logger.warning(f"Contact event missing 'contact' field: {evt}") return contact_state_key = WindowSetbackRule.__get_redis_key_contact_state(desc.id, device_id) - await ctx.redis.set(contact_state_key, '1' if contact_state == 'open' else '0') + await WindowSetbackRule.__redis_set(ctx, contact_state_key, '1' if contact_state == 'open' else '0') # Check if any contact is open is_open = False for contact_id in desc.objects.get('contacts', []): state_key = WindowSetbackRule.__get_redis_key_contact_state(desc.id, contact_id) - state_val = await ctx.redis.get(state_key) + state_val = await WindowSetbackRule.__redis_get(ctx, state_key) if state_val == '1': is_open = True break rule_state_key = WindowSetbackRule.__get_redis_key_rule_state(desc.id) - current_rule_state = await ctx.redis.get(rule_state_key) + current_rule_state = await WindowSetbackRule.__redis_get(ctx, rule_state_key) if is_open and current_rule_state != '1': # At least one contact is open, and we are not already in eco mode await self._set_eco_mode(desc, ctx) - await ctx.redis.set(rule_state_key, '1') + await WindowSetbackRule.__redis_set(ctx, rule_state_key, '1') elif not is_open and current_rule_state != '0': # All contacts are closed, and we are currently in eco mode await self._unset_eco_mode(desc, ctx) - await ctx.redis.set(rule_state_key, '0') + await WindowSetbackRule.__redis_set(ctx, rule_state_key, '0') async def _set_eco_mode(self, desc: RuleDescriptor, ctx: RuleContext) -> None: """Set thermostats to eco temperature when window opens.""" eco_target = desc.params.get('eco_target', 7.0) target_thermostats = desc.objects.get('thermostats', []) - ttl_secs = desc.params.get('previous_target_ttl_secs', 86400) ctx.logger.info( f"Rule {desc.id}: At least one window is opened, setting {len(target_thermostats)} " @@ -184,12 +200,12 @@ class WindowSetbackRule(Rule): # FIRST: Save current target temperatures as "previous" (before we change them!) for thermo_id in target_thermostats: current_key = WindowSetbackRule.__get_redis_key_current_target(desc.id, thermo_id) - current_temp_str = await ctx.redis.get(current_key) + current_temp_str = await WindowSetbackRule.__redis_get(ctx, current_key) if current_temp_str: # Save current as previous (with TTL) prev_key = WindowSetbackRule.__get_redis_key_previous_target(desc.id, thermo_id) - await ctx.redis.set(prev_key, current_temp_str, ttl_secs=ttl_secs) + await WindowSetbackRule.__redis_set(ctx, prev_key, current_temp_str) ctx.logger.debug( f"Saved previous target for {thermo_id}: {current_temp_str}°C" ) @@ -219,7 +235,7 @@ class WindowSetbackRule(Rule): # Restore previous temperatures for thermo_id in target_thermostats: prev_key = WindowSetbackRule.__get_redis_key_previous_target(desc.id, thermo_id) - prev_temp_str = await ctx.redis.get(prev_key) + prev_temp_str = await WindowSetbackRule.__redis_get(ctx, prev_key) if prev_temp_str: try: @@ -228,7 +244,7 @@ class WindowSetbackRule(Rule): ctx.logger.debug(f"Restored {thermo_id} to {prev_temp}°C") # Delete the previous key after restoring - await ctx.redis.delete(prev_key) + await WindowSetbackRule.__redis_delete(ctx, prev_key) except Exception as e: ctx.logger.error(f"Failed to restore {thermo_id}: {e}") else: @@ -260,9 +276,7 @@ class WindowSetbackRule(Rule): # Store current target (always update, even if it's the eco temperature) current_key = WindowSetbackRule.__get_redis_key_current_target(desc.id, device_id) - ttl_secs = desc.params.get('previous_target_ttl_secs', 86400) - - await ctx.redis.set(current_key, str(current_target), ttl_secs=ttl_secs) + await WindowSetbackRule.__redis_set(ctx, current_key, str(current_target)) ctx.logger.debug( f"Rule {desc.id}: Updated current target for {device_id}: {current_target}°C" From f4b52af78e2da196e9024581229fdc94d32dd105 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Fri, 6 Feb 2026 14:57:53 +0100 Subject: [PATCH 6/8] change regal licht kueche --- config/devices.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/config/devices.yaml b/config/devices.yaml index cf924ff..b7867ca 100644 --- a/config/devices.yaml +++ b/config/devices.yaml @@ -996,13 +996,14 @@ devices: homekit_aid: 83 name: Regallicht type: light - cap_version: "relay@1.0.0" - technology: hottis_led_stripe + cap_version: "light@1.2.0" + technology: zigbee2mqtt features: power: true + brightness: true topics: - state: "IoT/RgbLedStripeKitchen/ColorCommand" - set: "IoT/RgbLedStripeKitchen/ColorCommand" + state: "zigbee2mqtt/0x001788010d0ff4ba" + set: "zigbee2mqtt/0x001788010d0ff4ba/set" - device_id: regallicht_flur homekit_aid: 84 From d0db94280dd3fb231804637b7a774af816b225ae Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Fri, 6 Feb 2026 15:06:31 +0100 Subject: [PATCH 7/8] aid changed for home app --- config/devices.yaml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/config/devices.yaml b/config/devices.yaml index b7867ca..70fbc7e 100644 --- a/config/devices.yaml +++ b/config/devices.yaml @@ -992,19 +992,6 @@ devices: state: "zigbee2mqtt/0x64028ffffe50e79e" set: "zigbee2mqtt/0x64028ffffe50e79e/set" -- device_id: regallicht_kueche - homekit_aid: 83 - name: Regallicht - type: light - cap_version: "light@1.2.0" - technology: zigbee2mqtt - features: - power: true - brightness: true - topics: - state: "zigbee2mqtt/0x001788010d0ff4ba" - set: "zigbee2mqtt/0x001788010d0ff4ba/set" - - device_id: regallicht_flur homekit_aid: 84 name: Regallicht Flur @@ -1187,4 +1174,17 @@ devices: topics: state: "test/thermostat1/state" set: "test/thermostat1/set" - \ No newline at end of file + +- device_id: regallicht_kueche + homekit_aid: 100 + name: Regallicht + type: light + cap_version: "light@1.2.0" + technology: zigbee2mqtt + features: + power: true + brightness: true + topics: + state: "zigbee2mqtt/0x001788010d0ff4ba" + set: "zigbee2mqtt/0x001788010d0ff4ba/set" + From 851d4a55819bc3ff878883cba8692346700eecfd Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 12 Feb 2026 22:54:08 +0100 Subject: [PATCH 8/8] add licht dachboden --- config/devices.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/config/devices.yaml b/config/devices.yaml index 70fbc7e..702c7c7 100644 --- a/config/devices.yaml +++ b/config/devices.yaml @@ -1188,3 +1188,14 @@ devices: state: "zigbee2mqtt/0x001788010d0ff4ba" set: "zigbee2mqtt/0x001788010d0ff4ba/set" +- device_id: licht_dachboden + homekit_aid: 101 + name: Dachboden + type: relay + cap_version: "relay@1.0.0" + technology: hottis_wago_modbus + features: + power: true + topics: + set: "pulsegen/command/6/17" + state: "pulsegen/status/6"