Simultaneously executed automations

Hello community,

I have an annoying problem.
I use automations to trigger e.g. adjusted brightness of the lighting in different time periods or conditions.

So it happens that some automations overlap in time, but not their conditions.

Example:

Automation “Corridor evening” with the time window 22:00-6:00 (10pm-6am) regulates the lighting in the corridor to 20%.
Automation “Corridor day” takes over from 6:00-18:00 (6am-6pm) and regulates to 60% etc.
However, if the “Bedtime” mode is active, the “Corridor Bedtime” automation takes over and sets the lighting to 5%, regardless of the time window.

Now it sometimes happens that you realise that the automation is actually triggered for a time window, but is immediately overwritten by “Bedtime”. The light flashes briefly (e.g. at 60%) and immediately jumps to 5%.

I don’t know why this is the case, because all automations query whether the “Sleep time” mode is active or not and should therefore prevent it from being executed.

Can anyone tell me what could be the reason for this? Do I have an error in the process?

Automation “Bedtime”:

alias: "Badezimmer: Licht ein bei Anwesenheit (Schlafenszeit)"
description: ""
triggers:
  - type: occupied
    device_id: 1c395c0021239e44ff706924d996e513
    entity_id: 6a5ca052c2f14312f8e5c8ba2a6adc67
    domain: binary_sensor
    trigger: device
conditions:
  - condition: numeric_state
    entity_id: input_number.schlafenszeit
    above: 0
actions:
  - action: light.turn_on
    metadata: {}
    data:
      rgb_color:
        - 255
        - 180
        - 107
      brightness_pct: 1
    target:
      entity_id:
        - light.deckenleuchte_badezimmer_segment_001
        - light.deckenleuchte_badezimmer_segment_005
        - light.deckenleuchte_badezimmer_segment_009
mode: single

Automation Evening:

alias: "Badezimmer: Licht ein bei Anwesenheit (Abend)"
description: ""
triggers:
  - type: occupied
    device_id: 1c395c0021239e44ff706924d996e513
    entity_id: 6a5ca052c2f14312f8e5c8ba2a6adc67
    domain: binary_sensor
    trigger: device
conditions:
  - condition: time
    after: "18:00:00"
    before: "22:00:00"
  - condition: numeric_state
    entity_id: input_number.schlafenszeit
    below: 1
actions:
  - action: light.turn_on
    metadata: {}
    data:
      brightness_pct: 15
      kelvin: 3700
    target:
      entity_id:
        - light.deckenleuchte_badezimmer
mode: single

Neither set the high brightness, have you looked at aexcution times and traces to see if they indeed both fired? Or if there’s another automation that fired at the same time?

It sounds more to me like the light has weird behavior when turning it on at a specific brightness.

Out of curiosity, why is input_number.schlafenszeit a number?

1 Like

I can’t rule out the possibility that it’s the lamp because the indirect LEDs are activated during the special bedtime and not the main LEDs. I’ll take a closer look at this again.

I use a number for the mode so that the last status is retained when HA is restarted. A boolean switch jumps back.

Huh? an input boolean should retain state just as well. I have plenty. You have to be aware of changes from unavailable to on/off though, numbers don’t have that problem.

1 Like

Omg… are you kiddin?! My latest knowledge is that switches are always reset to their original state.
This is the only reason why I have changed all important “switches” to numerical inputs.

I found out that another automation was interfering, which I had named incorrectly when I created it some time ago.
And to my delight, the boolean switches are actually retained.

So all is well.