Condition in automation failing

I have an automation that turns on a space heater every time my Nest thermostat stops heating but only if the temperature in the room reported by a sensor is below 71.

  - alias: 'Space Heater ON if Nest STOPS Heating'
initial_state: on
trigger:
  - platform: state
    entity_id: sensor.nest_thermostat_hvac_state
    from: 'heating'
    to: 'off'

condition:
  condition: and
  conditions:
     - condition: time
       after: '07:00:00'
       before: '21:30:00'
     - condition: state
       entity_id: input_boolean.heater
       state: 'off'
     - condition: numeric_state
       entity_id: sensor.home_living_room_temperature
       below: 71
     - condition: or
       conditions:
         - condition: state
           entity_id: device_tracker.iphone1
           state: 'home'
         - condition: state
           entity_id: device_tracker.iphone2
           state: 'home'
         - condition: state
           entity_id: alarm_control_panel.home
           state: 'disarmed'

action:
  - service: input_boolean.turn_on
    entity_id: input_boolean.heater

But it fails. Right now it turned on even though the temperature reported by the sensor is 72.

Where am I going wrong?

Not sure what you’re using, but my /dev-state tab shows alarm_control_panel.home_alarm for the alam panel, not alarm_control_panel.home.

And although I have not experienced it myself, I read that some people had issues when they had the AND conditions spelled out explicitly as you have it in the two lines:

  condition: and
  conditions:

As the conditions default to AND these lines are not necessary, strictly speaking.

1 Like

Turns out I was missing apostrophe around ‘71’.

Thank you for taking the time and helping out!