[platform] is an invalid option for [automation]. Works as a trigger but not a condition?

This automation works:

- id: '1550335356378'
  alias: Humidity > 70%
  initial_state: true
  hide_entity: false
  trigger:
  - platform: template
    value_template: '{{states.sensor.humidity.state | float > 71.00}}'
  - platform: template
    value_template: '{{states.sensor.light_level.state | float < 5.00}}'  
  action:
  - service: switch.turn_off
    entity_id: switch.R6_Hazer

This automation fails config with the error:

Invalid config for [automation]: [platform] is an invalid option for [automation]. Check: automation->condition->0->platform.

- id: '1550335356318'
  alias: Humidity < 70%
  initial_state: true
  hide_entity: false
  trigger:
    platform: template
    value_template: '{{states.sensor.humidity.state | float < 70.00}}'
  condition:
  - platform: template
    value_template: '{{states.sensor.light_level.state | float > 5.00}}'
  action:
    service: switch.turn_on
    entity_id: switch.R6_Hazer

Kind of confused the templates are identical. Any Ideas?

Please format your code. This is unreadable.

1 Like

change platform to condition:

  condition:
    condition: template
    value_template:  '{{states.sensor.humidity.state | float > 71.00}}'

Correct. Conditions look at the entity_id and the state of it.
Take a look at the docs for Conditions. https://www.home-assistant.io/docs/scripts/conditions/

If you’re looking at using a template for a condition, you’re going to want to actually create the device as a template device and then use a Condition based on its state.

1 Like

@techwithjake This is not needed. Look at the docs.

1 Like

True true. I just find it easier to manipulate that way.

1 Like

Pippyn, perfect many thanks!

Will do jake.

How is this supposed to work? It triggers when the humidity is below 70 then the condition checks if the humidity is above 71.

How can the action ever be executed if the value that triggers the automation will always be less than what the condition allows?

  trigger:
    platform: template
    value_template: '{{states.sensor.humidity.state | float < 70.00}}'
  condition:
    platform: template
    value_template:  '{{states.sensor.humidity.state | float > 71.00}}'
  action:

You are correct obviously, at the time I was more concerned with the .ymal passing check config, rather then the exact logic.

I’ve fixed it in the original post now.