drk
(alex)
February 18, 2019, 3:25pm
1
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?
Pippyn
February 18, 2019, 3:27pm
2
Please format your code. This is unreadable.
1 Like
Pippyn
February 18, 2019, 3:32pm
3
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
Pippyn
February 18, 2019, 3:35pm
5
1 Like
True true. I just find it easier to manipulate that way.
1 Like
drk
(alex)
February 18, 2019, 8:11pm
7
Pippyn, perfect many thanks!
Will do jake.
123
(Taras)
February 18, 2019, 8:36pm
8
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:
drk
(alex)
February 18, 2019, 10:17pm
9
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.