Climate automation only uses 1 out of 2 triggers

Hey guys,

i’m using two automations to control the temperature of my thermostats. The automation for the away mode (18°C overall) works fine, the automation for the away mode doesn’t work like it should.

1. Setting i want to have

If i am at home (or in the “heating”-zone 5km around my house to avoid “away”-mode if i’m out for a short walk), the thermostat should adjust the temperature depending on the time.

The temperature in the livingroom should be always at 23°C.

The temperature in the bathroom should be 23°C between 07:00 and 23:00 o’clock.
At night, the temperature should be 18°C.
If i have early shift at work, the temperature should be set from 18°C to 23°C at 04:00 o’clock instead of 07:00 o’clock.

2. My current automation

Trigger:

  1. The relevant time stamps are 04:00 / 07:00 / 23:00 o’clock. So those times are the first triggers.
  2. If i enter the heating-zone or home, the automation should also check what time it is and set the right temperature. So those zones are the next triggers.

Condition:
I have two conditions. Beeing in the heating-zone or at home. The conditions are linked as an “or” condition.
I use this condition, that the time triggers don’t fire if i’m not at home and the temperature stays at 18°C.

Action:
The first action sets the temperature in the livingroom to 23°C degrees. No matter what time.

The second action is a “choose”-action for the bathroom.
If a binary sensor is open (linked to my calender. Opens if i have early shift at work) and the time is around 04:00 o’clock -> set the temperature to 23°C.
Default setup if i have no early shift: If actual time is between 07:00 and 23:00 o’clock -> temperature to 23°C, else 18°C.

3. Problem. Parts of the automation that doesn’t work

The automation works perfect with the time triggers. If i’m away, the condition “kills” the automation and the temperature stays at 18°C. If i’m at home at 04:00 / 07:00 / 23:00 o’clock the automation fires and sets the temperature as requested to the temperature set at the action.

BUT:
The automation doesn’t work with the zone triggers.
I use the companion-app of HA for location tracking and DuckDNS for remoter access.
The tracking works fine. If i enter or leave the zones the logbook recognizes the changes and set the state of the person entity to the correct zone.
Unluckly the automation doesn’t recognize this change of the zone und doesn’t fire.
I have no idea where the problem is…
Could it be, that the automation instant fires if i enter one of the zones above, but the state of the “person”-entity change to slow, that the condition of the automation isn’t fulfilled and “kills” it?

Sure, i could split it up into two automations for time triggers and zone triggers, but thats not the way i want to have it.

I hope someone has an idea =)

Best regards
Yves

alias: Temperatur bei Anwesenheit erhöhen
trigger:
#Triggert, sobald ich in den Heizradius komme
- platform: zone
  entity_id: person.yves
  zone: zone.heizung_anwesenheit
  event: enter

#Triggert, sobald ich daheim ankomme
- platform: zone
  entity_id: person.yves
  zone: zone.home
  event: enter #Bei Abwesenheit "leave"

#Triggert um 04:00 / 07:00 / 23:00 Uhr, auch wenn ich schon zu Hause bin
- platform: time
  at: "04:00"
- platform: time
  at: "07:00"
- platform: time
  at: "23:00"


#Die Condition sorgt dafür, dass die Automation nur auslöst wenn ich daheim bin. Ansonsten überschreibt der Time-Trigger die Abwesenheitsautomatik
condition:
  condition: or
  conditions:
    - condition: state
      entity_id: person.yves
      state: "heizung_anwesenheit"
    - condition: state
      entity_id: person.yves
      state: "home"


action:
#Das Wohnzimmer soll bei Anwesenheit immer auf 23°C sein, daher reicht diese einfache Action
- service: climate.set_temperature
  entity_id: climate.heizung_wohnzimmer_yves
  data:
    temperature: 23.0 #Kommazahlen müssen nach amerikanischem Standard mit . geschrieben werden

#Das Badezimmer soll variabel von der Uhrzeit gesteuert werden. Zusätzlich muss hier berücksichtigt werden ob Frühdienst ist oder nicht

#Mit "choose" wird festgelegt, bei welchen Bedingungen wie reagiert werden soll. Default ist die Standardlösung falls es keine Sonderfälle gibt.
#Jeder "- conditions" gibt eine eigene zu prüfende Variante an.
- choose:
#Erste Regel ("If"): Falls Frühdienst ist wird die Heizung im Bad schon um 4 auf 23°C aufgeheizt. Die Zeitbedingung ist zusätzlich erforderlich, da der Sensor schon am Vortag aufmacht.
  - conditions:
    - condition: state
      entity_id: binary_sensor.dienstkalender_frueh
      state: "on"
    - condition: time
      after: "03:59:55"
      before: "06:59:55"
    sequence:
    - service: climate.set_temperature
      entity_id: climate.badezimmer
      data:
        temperature: 23.0
#Normallösung ohne Sonderfälle ("Else"):
  default:
  - service: climate.set_temperature
    entity_id: climate.badezimmer
    data_template:
      temperature: > #Zur Steuerung von variablen Temperaturen, abhängig von der Uhrzeit
        {% set  hour = now().hour | int  %}
        {% if   hour >=  7 and hour < 23  %} 23
        {% else                          %} 18
        {% endif %}