for my sisters Home assistant. i setup a automation turns on her garage light at 9:30 till 10pm and it works great… and i linked it to a button
but if she wants to hit the automation button to turn it off leaves the light on… anyway to turn it off when you press the button?
2nd…
for my sisters Block heater… i had to do a script to a button… so when she presses it… it runs a timer for 4 hours then shuts off the switch/plug … but id also like it if you press Turn 4 Hour timer button to off… that it would turn off the plug… instead of turning off the script but leaving the plug still on
1 for the button and 2nd one to toggle the timer and toggle the switch/plug for the light and block heater
but was hoping it to be all in 1 automation so 1 for light 1 for block heater not 4 1 to turn on off garage light automation and 1 to turn on and off the block heater automation… so then youd have 4 automations/scripts for 2 devices
so
for light
1… press timer light button automation it comes on at 9:30 but if button gets pressed again say 9:40pm it turns off the automation and turns off the Light
2… same like above
press the timer for 4 hours for block heater… within that 4 hours you press it again it shuts off the script and shuts off the block heater switch
i wasnt able to make it an automation i tried all the options but u always need a trigger… just starting the automation wasnt a good enough trigger
i tried to make the script an automation but apparently you cant create an automation without using a trigger… i figure using no trigger automaticlly causes the automation to run from the moment you enable the automation… but it doesnt
in the end i figured you cant do it in 2 automations/scripts
1 for the light 1 for heater… probably needs a second one for checking things and the first one all it does is toggle…
@walrus_parka so i not sure can it be done in 2 automations 1 for each… if possible?
or is you need 1 to toggle things and 2nd one runs timers?
havent figured it out but figured id ask
or can you do a group thing
so a like the 1 button be
switch_group_1:
Light:
Is there a reason to have the automation toggled via UI? Why not have the button reference the light itself and run the automation in the background?
Heater:
A way to accomplish the heater is to have an input_boolean named “m_block_heater” be toggled in the UI. It would trigger the automation and you could use it to match the state of the heater.
EDIT: Example worked on my config. Input boolean will track the switch if it is turned off manually as well.
as for the light i made it simple for my sister…
so i use simple scheduler and i set the timer to turn on on 9:30pm till 10pm on monday and tuesdays as she gets home from work…
but sometimes she works other nights and gets home same time
so my simple way was press a button on her cell or tablet… before she leaves for work so then automation turns on turns light on at 9:30 shuts off at 10pm and then disables the automation as it a once and a while… it works but if i were to turn it off during the 9:30-10 then the automation isnt able to turn it off when you turn off automation… so i wanted click button turn on automation if you click it off before 9:30pm no big deal… but if u click it within the 930 10 window i want it to turn off the automation and turn off the light… for now i only get it to turn off the automation
and same for the block heater it also doubles for my mother…
so they can both Just press Button on the tablet or phone to Activate it for 4 hours and after 4 hours it shuts off so at anytime…
and works well for that
but if they were to turn it off the timer it leaves the heater on… but i also want if you press the heater timer to also turn off the heater plug
and i do have 2nd buttons for each one to turn on the garage light and 1 for heater plug
i added these timer options as my sister kept asking me to adjust her scheduler each day for her work… so instead i wanted it to work it on her own just press button and it just goes
they both work well if you let the timer run its course but not if you wanna turn off the automation when its running
Technically speaking, your script doesn’t employ a timer entity, it uses a delay statement. In addition, it’s a long delay of 4 hours. If you execute Reload Scripts or restart Home Assistant during that 4-hour period, the delay will be cancelled (and the block heater will not be turned off). You don’t even have to explicitly execute Reload Scripts because it’s done in the background whenever you use the Script Editor to save a new/modified script.
To avoid the risk of failing to turn off the block heater, the script needs to be re-designed to be immune to reloads/restarts. Let me know if you want help with that.
@walrus_parka ok ya id like to learn.
i posted last year in the Features request… for when home assistant reboots to remember the timers… as i use one for my hot water tank… after 5 hours shuts off… and i had another automation that when reboots 5 hours from time HA reboots to shut off hot water tank as a safety… i think only 5 votes on that feature request i posted…
but ya id learn
@123 ok so basiclly its a If Statement then If On go this route if Off do nothing
so reason i turn on and off the automation… my sister likes it i have Red for Off Devices and Green for On
so reason i did the automation so when she presses the button the she sees the Automation is On and it will come on for 9:30 till 10pm
as can you display the input boolean as a Button so On is green and Off is Red?
and then does it turn off when you press the button… is that the condition…
so either run out the time… or turn off when the Button is pressed
ill try your both codes above when i get home later today…
and then the option for the block heater…
i seen there is blueprint stuff but no option for what i wanted … be nice for anyone else if they wanted a blue print …