Very new to HA but loving it. So far i have a few RF outlets, sonoffs and yeelights but looking to incorporate more devices soon.
Hopefully someone can help me with turning on an RF outlet(switch.switch_1) for one hour. I have these installed for electric heaters and lamps and would love this feature. I dont want specified time in the day but just on for 60 mins then off again.
I know im asking you guys to do all the hard work but i tried reading the supporting documentation for automation and cant really make sense of it.
Also, If i did get it to work would i be able to still turn on the heater with the toggle switch like norma or would it override this. Can i have both or is it an either or?
I do this with a sports equipment dryer connected to a z wave switch. I can set the length of time I want the dryer running using an input_number. It is an automation that calls a script to handle the on/off and timer. This is probably overkill, but works for my needs.
as you can see from the image the automation is a toggle switch and it needs to be enabled and then i need to switch on the radiator for the one hour automation. I also need to disable the automation if i want the switch to be on longer.
Is there a way to have the automation disabled most of the time and then start it by clicking one button and the switch will turn on as well?
now the automation can act as your heater 1 hour timer. when the automation is off you can manually toggle the heater on/off and it will not automatically turn off unless the automation gets turned on. also if you turn the heater on manually but then later on know you want it to auto shut off, you can then toggle the automation on and it will automatically shut off the heater after 1 hour. However, the reverse will not work. you cannot start an automation and then take manual control. once the automation is started, turning off the automation will only disable it from being activated by its triggers. to take manual control of the actions, I suggest putting them into a script like I did, that way you can manually turn off the script effectively stopping the timer without shutting off the heater.
EDIT: Someone please test this. my concern with the automation is if the timing is right. If the automation has to be on prior to seeing the trigger. if it’s not on/ready and it misses the state transition, does it execute? or if it doesn’t care about the state transition and only cares if the state is ever whatever it is looking for, then trigger.
Soooo… I think I just created a “useless box” or “useless machine” in code… the script shuts itself off if it gets turned on… Although the script has a usefulness to it, at its root, it is still “useless”
I set up an automation that would switch off the bathroom fan after 1-hour and it works quite well - you could just change the entityID, initial state and final state to get it to work how you want:
#Automatically turn off the ensuite bathroom fan
- alias: Ensuite fan auto off
trigger:
- entity_id: light.bedroom_1_ensuite_fan
from: 'off'
platform: state
to: 'on'
action:
- delay:
minutes: 60
- alias: Turn off fan
data:
entity_id: light.bedroom_1_ensuite_fan
service: light.turn_off
yes, that works for turning something off after a period of time after it was turned on. very similar to what I posted as pseudo code above. however, their follow up question was being able to essentially override the shutoff timer and be able to have the device on for however long they want and not turn off. for that you have to get creative with automation, scripting, and triggers.
Essentially, I want 2 toggles.
Toggle 1: Turn radiator on/off (manual button / alexa)
Toggle 2: Turn radiator on for one hour only
EDIT:
Ok i tried it 5 times and it worked one. Very odd. I realised a mistake and changed the entity id to the correct name. Very strange that it only worked once