I find out that it is possible to manage automation similar with scripts by turning them on or off, while this is not described in automation topics (at least I didn’t find), so I mention it here with examples, this may help other people:
Very true. I found another solution to this problem that is more complicated than using automation.turn_on/automation.turn_off. I created an input boolean and created an automation to turn it on and off. Then in my other automation, I made the input boolean a condition. I might have to revisit my automatons and use this instead. Thanks for the post.
It’s just like any other service as shown in the docs:
But if you feel it needs to be documented, you can update the service calls page by clicking on the link to “Edit this page in GitHub” in the upper right hand corner. That would be helpful if you’re willing to do so.
You right, it is a service, but this is not obvious for everybody. I will take a look closer through the pages, I am not sure where is best to mention this, I think somwhere in automation pages could be inserted an action example of script and automation management.
Thank you
I am struggling to get a automation working that I think is similar to yours and wonder if you might have any suggestions. I want to click a button from home assistant that uses my pi’s gpio pins to turn on switch_1, and 2 seconds later turns on switch_2. Switch_1 should stay on until I turn it off or for 10 minutes, whichever comes first. Switch_2 should only stay on for .5 seconds.
I have spent a few hours messing around with gpio switch, and pi covers time_delay without success. Any thoughts on how to configure that?
I am running 0.51.2 on a raspberry pi 3 that I setup using Hassio.
trigger virtual_button
action
turn_on: switch.switch1
turn_on: switch.switch2
delay (1s) (I think only appdaemon can do less than 1s?)
turn_off: switch.switch2
delay (10mins)
turn_off: switch.switch1
Which I think is pretty much what @rpitera was saying.
Thanks for the ideas. I’m not finished making the automation (some of my labels are just dummies), but this is working:
- id: sub
alias: sub
initial_state: true
trigger:
platform: state
entity_id: switch.car_start
to: ‘on’
action:
- service: switch.turn_on
data:
entity_id: switch.car_on
- delay:
seconds: 1
- condition: state
entity_id: switch.car_on
state: ‘on’
- service: switch.turn_on
data:
entity_id: switch.car_lock
- delay:
milliseconds: 500
- service: switch.turn_off
data:
entity_id: switch.car_lock
(I tried using the preformatted text option but it doesn’t look like it worked…)
This will allow me to remotely start my car. I have a relay that turns the car on (like turning the ignition half way), I will then check to make sure the car is on but not running, then I have a relay that cranks the starter for .5 seconds.