I have all my switches working and am trying to figure out how to trigger a water valve switch for a mister for my animals when the weather gets hot.
Sudo code:
If weather.temperature > 75 F Then
turn on water switch for 1 minute
delay 30 min and repeat until
weather.temperature < 75 F
Here’s the info from my states UI
weather.hop_house sunny
temperature: 76.3
humidity: 36
pressure: 1014.6
wind_bearing: 240.5
wind_speed: 7.6
attribution: Weather forecast from met.no, delivered by the Norwegian Meteorological Institute.
friendly_name: HOP House
I don’t see this entity appear in any trigger options anywhere. I was reading a post about templates but haven’t ventured there yet. I also discovered that I may get caught up in triggering this continually and may need a binary switch in a template. I’m also not sure that the Norwegian Meteorological Institute is the best place to get my weather forecast info…
I’ll give you the properly formatted basic functionality but you will have to add in the details:
alias: the name of the automation
trigger:
platform: time_pattern
minutes: '/30'
condition:
platform: template
value_template: '{{ state_attr('weather.hop_house', 'temperature') | int > 75 }}'
action:
- service: switch.turn_on
entity_id: switch.your_water_switch
- delay: '00:01:00'
- service: switch.turn_off
entity_id: switch.your_water_switch
What this should do is every 30 minutes it will check to see if the temperature attribute of the sensor is over 75 degrees and will turn on the water switch, wait 1 minute and then turn off the water switch.
It will run every 30 minutes 24 hours a day so If you don’t want that then you will need to add in a time of day condition as well.
can not read an implicit mapping pair; a colon is missed at line 86, column 86:
... ', 'temperature') | int > 75 }}'
^
And this error when restarting
Error loading /config/configuration.yaml: while parsing a block mapping
in "/config/automations.yaml", line 85, column 5
expected <block end>, but found '<scalar>'
in "/config/automations.yaml", line 86, column 37
I read up on automation templates and the formatting looked ok to me.
Invalid config for [automation]: [platform] is an invalid option for [automation]. Check: automation->condition->0->platform. (See /config/automations.yaml, line 78).
Researching this error, I see something about conditions in this post,
Error:
Invalid config for [automation]: [platform] is an invalid option for [automation]. Check: automation->condition->0->platform. (See /config/automations.yaml, line 1). Please check the docs at https://home-assistant.io/components/automation/