Skip to content

Commit

Permalink
fixed bug in light rules
Browse files Browse the repository at this point in the history
  • Loading branch information
nobbi1991 committed Oct 5, 2024
1 parent 6e0f622 commit 9738696
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion habapp_rules/actors/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down
2 changes: 1 addition & 1 deletion tests/actors/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
2 changes: 1 addition & 1 deletion tests/helper/oh_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9738696

Please sign in to comment.