Skip to content

Commit

Permalink
fix: Bug where lights turn off unexpectedly
Browse files Browse the repository at this point in the history
This fixes the following issue: user is in the room and the lights dim
because motion has not been triggered for a while. The user presses the
"on" button to say "no, I don't want the lights to turn off". Before
this change, the lights would become brighter again but the turn off
timer wouldn't be cancelled so the lights would turn off anyway.

After this change, the turn off timer will be cleared when the lights
are changed by a human so they won't unexpectedly turn off when the user
has just turned them back on/brightness up.
  • Loading branch information
dansimau committed Jan 4, 2025
1 parent c482f70 commit 3d4d060
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions automations/sensor_lights.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,13 @@ func (a *SensorsTriggerLights) handleSensorTriggered() {
}

func (a *SensorsTriggerLights) handleLightTriggered() {
// Light was either turned on or off, or brightness changed or whatever,
// in which case we want to stop any further automations since the user has
// overridden it and we want to respect that.
a.stopDimLightsTimer()
a.stopTurnOffTimer()

if a.humanOverrideFor != nil {
a.stopTurnOffTimer()

if a.lightsOn() {
a.humanOverrideTimer.Reset(*a.humanOverrideFor)
} else {
Expand Down

0 comments on commit 3d4d060

Please sign in to comment.