Skip to content

Commit

Permalink
Stop dim timer when sensors are activated
Browse files Browse the repository at this point in the history
  • Loading branch information
dansimau committed Dec 29, 2024
1 parent 59d1481 commit 5a8462a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions automations/sensor_lights.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ func (a *SensorsTriggerLights) stopTurnOffTimer() {
}
}

func (a *SensorsTriggerLights) stopDimLightsTimer() {
if a.dimLightsTimer != nil {
a.dimLightsTimer.Stop()
}
}

func (a *SensorsTriggerLights) turnOnLights() {
var attributes map[string]any

Expand Down Expand Up @@ -240,6 +246,7 @@ func (a *SensorsTriggerLights) Action() {
if a.triggered() {
a.log.Info("Sensor triggered, turning on lights")
a.stopTurnOffTimer()
a.stopDimLightsTimer()
a.turnOnLights()
} else {
a.log.Info("Sensor cleared, starting turn off countdown")
Expand Down

0 comments on commit 5a8462a

Please sign in to comment.