From 9738696e2377b6e0706f9dbcb8b5818b093b82d8 Mon Sep 17 00:00:00 2001 From: nobbi1991 <48419518+nobbi1991@users.noreply.github.com> Date: Sat, 5 Oct 2024 19:44:19 +0200 Subject: [PATCH] fixed bug in light rules --- changelog.md | 4 ++++ habapp_rules/actors/light.py | 2 +- tests/actors/light.py | 2 +- tests/helper/oh_item.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 163169e..b34b918 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,10 @@ - added temperature difference item of ``habapp_rules.sensors.sun.SensorTemperatureDifference`` to ``filtered_signal_groups`` - added rule ``habapp_rules.actors.power.CurrentSwitch`` which can be used to enable a switch item if current is above a threshold +## Bugfix + +- fixed bug in ``habapp_rules.actors.light.LightSwitchExtended`` and ``habapp_rules.actors.light.LightDimmerExtended`` which did not re-trigger the timer if a door was opened. + # Version 6.1.0 - 19.08.2024 ## Features diff --git a/habapp_rules/actors/light.py b/habapp_rules/actors/light.py index 9f7e5ee..3d8d380 100644 --- a/habapp_rules/actors/light.py +++ b/habapp_rules/actors/light.py @@ -576,7 +576,7 @@ def _add_additional_transitions(transitions_list: list[dict]) -> list[dict]: transitions_list.append({"trigger": "motion_timeout", "source": "auto_motion", "dest": "auto_off", "unless": "_pre_off_configured", "before": "_log_motion_timeout_warning"}) transitions_list.append({"trigger": "hand_off", "source": "auto_motion", "dest": "auto_off"}) - transitions_list.append({"trigger": "door_opened", "source": ["auto_off", "auto_preoff"], "dest": "auto_door", "conditions": ["_door_configured", "_motion_door_allowed"]}) + transitions_list.append({"trigger": "door_opened", "source": ["auto_off", "auto_preoff", "auto_door"], "dest": "auto_door", "conditions": ["_door_configured", "_motion_door_allowed"]}) transitions_list.append({"trigger": "door_timeout", "source": "auto_door", "dest": "auto_preoff", "conditions": "_pre_off_configured"}) transitions_list.append({"trigger": "door_timeout", "source": "auto_door", "dest": "auto_off", "unless": "_pre_off_configured"}) transitions_list.append({"trigger": "door_closed", "source": "auto_leaving", "dest": "auto_off", "conditions": "_door_off_leaving_configured"}) diff --git a/tests/actors/light.py b/tests/actors/light.py index fe406f1..af5700a 100644 --- a/tests/actors/light.py +++ b/tests/actors/light.py @@ -1404,7 +1404,7 @@ def test__init__(self): {"trigger": "motion_timeout", "source": "auto_motion", "dest": "auto_preoff", "conditions": "_pre_off_configured", "before": "_log_motion_timeout_warning"}, {"trigger": "motion_timeout", "source": "auto_motion", "dest": "auto_off", "unless": "_pre_off_configured", "before": "_log_motion_timeout_warning"}, {"trigger": "hand_off", "source": "auto_motion", "dest": "auto_off"}, - {"trigger": "door_opened", "source": ["auto_off", "auto_preoff"], "dest": "auto_door", "conditions": ["_door_configured", "_motion_door_allowed"]}, + {"trigger": "door_opened", "source": ["auto_off", "auto_preoff", "auto_door"], "dest": "auto_door", "conditions": ["_door_configured", "_motion_door_allowed"]}, {"trigger": "door_timeout", "source": "auto_door", "dest": "auto_preoff", "conditions": "_pre_off_configured"}, {"trigger": "door_timeout", "source": "auto_door", "dest": "auto_off", "unless": "_pre_off_configured"}, {"trigger": "door_closed", "source": "auto_leaving", "dest": "auto_off", "conditions": "_door_off_leaving_configured"}, diff --git a/tests/helper/oh_item.py b/tests/helper/oh_item.py index 367b48b..8f416b6 100644 --- a/tests/helper/oh_item.py +++ b/tests/helper/oh_item.py @@ -108,7 +108,7 @@ def item_state_change_event(item_name: str, value: StateTypes, old_value: StateT HABApp.core.EventBus.post_event(item_name, HABApp.openhab.events.ItemStateChangedEvent(item_name, value, prev_value)) -def assert_value(item_name: str, value: StateTypes, message: str = None) -> None: +def assert_value(item_name: str, value: StateTypes | None, message: str = None) -> None: """Helper to assert if item has correct state :param item_name: name of item