Valid syntax, searched my arse off to no avail.
action:
- choose:
- conditions:
- condition: template
value_template: >-
{{ states['sensor.study_sensor_temperature'].state | int >
states['input_number.study_temp_threshold'].state | int + 4 }}
sequence:
- service: fan.turn_on
target:
entity_id: fan.study
data:
percentage: 60
default:
- service: fan.turn_on
target:
entity_id: fan.study
data:
percentage: 30
mode: single
Message malformed: extra keys not allowed @ data[‘action’][0][‘choose’][0][‘conditions’][0][‘sequence’]
Sadly, I had saved it this way at some point and didn’t realize it. I noticed the fan speed up, exited and re-entered the automation editor and there it was. Here’s the whole thing for what it’s worth:
alias: 'Study auto fan: On'
description: ''
trigger:
- platform: state
entity_id: binary_sensor.study_motion
to: 'on'
condition:
- condition: state
entity_id: switch.study_auto_fan
state: 'on'
- condition: numeric_state
entity_id: sensor.study_sensor_temperature
above: input_number.study_temp_threshold
action:
- choose:
- conditions:
- condition: template
value_template: >-
{{ states['sensor.study_sensor_temperature'].state | int >
states['input_number.study_temp_threshold'].state | int + 8 }}
sequence:
- service: fan.turn_on
data:
percentage: 90
target:
entity_id: fan.study
- conditions:
- condition: template
value_template: >-
{{ states['sensor.study_sensor_temperature'].state | int >
states['input_number.study_temp_threshold'].state | int + 4 }}
sequence:
- service: fan.turn_on
target:
entity_id: fan.study
data:
percentage: 60
default:
- service: fan.turn_on
target:
entity_id: fan.study
data:
percentage: 30
mode: single