Apologies if this has been answered elsewhere, I’m relatively new to home assistant and its forums. I’ve been trying to write an automation where a fogging device turns on every hour for 14 minutes but despite my efforts it doesn’t seem to work and I don’t quite understand why.
The fogger is connected via raspberry pi gpio to a relay and the relay is controlled via home assistant. I can trigger the relay manually in home assistant and it works, so everything is wired correctly.
My automation.yaml code is as follows:
- alias: Fogger turns on for 14 minutes every 1 hour
trigger:
- platform: time
hours: '/1'
minutes: '00'
seconds: '00'
action:
- service: switch.turn_on
entity_id: switch.Fogger
- delay:
minutes: '14'
- service: switch.turn_off
entity_id: switch.Fogger
That also. Timers and delays currently don’t survive HA restarts.
Also keep in mind that re-triggering an automation while it’s currently in a delaywill abort the delay and continue with the next action in the sequence.
I am afraid that for some reason I know I should see how this works, but I am not.
If I am reading this right then the newest iteration here would trigger every hour (/1) and every 5 minutes after the hour (5), and based upon when the trigger was triggered the action would either run the if of ON or OFF.
Is this correct?
If so, does this mean that to create a simple automation that turns an entity on for a specified amount of time you can simply copy and paste this into a new automation YAML and replace the entity_id with your preferred entity and the time pattern with your required one and it would be one and done?
No more time deltas, no more multiple automation, one to turn on, one to turn off, etc?
It work well. But i would like to add a temperature condition to “ON” id only. For example, every hour i check if outdoor temperature is below 5 if yes i turn the switch on. And set to off the switch without condition after 15 minutes.