I’m somewhat of a beginner with Home Assistant and having got most of my basic functionality working as I want, I’m beginning to think about more niche little automations that would be helpful for me - without having any knowledge of yaml or coding and no brain space to learn about it at the moment…lol
The automation I’m currently thinking about is having a switch I can turn on when I have visitors so HA will monitor the temperature in the downstairs toilet (which is usually super chilly), and make sure it’s comfortably warm and more pleasant to use! lol.
I’ve had an initial go at doing this by creating a toggle helper. When this is toggled to on, HA checks a condition (the current temperature of the Drayton Wiser TRV in the downstairs toilet) and if it’s below the temperature I want, the automation has the action to change the TRV preset to boost the heat in the room for one hour.
This seems to work but what I’m not sure about is if this is just one time event that happens the moment I toggle the helper to on, or if the automation will continue to monitor the TRV’s current temperature the whole time the toggle is switched to ‘on’?
Essentially, my question is, if an automation is triggered by a toggle being switched on, and has conditions which which need to be met before an action is taken, does the automation check the condition and then take the action only at the point the toggle is turned on, or will it continue to monitor the condition all the while the toggle is on?
If the automation only checks the condition when the switch is toggled on, is there a way to make HA continue to monitor the condition?
I hope that makes sense, any help muh appreciated.
When you want an automation to run when two separate conditions are true, you should put them both as triggers and both as conditions.
In your case, I believe that would be
Helper toggle is true
Temperature in bathroom is lower than some threshold
Once you switch the helper to true, the automation will run and will boost heat if the bathroom is cold. When the bathroom gets cold several hours later, the automation will trigger if the helper toggle is still set to true.
That sounds like a pretty good plan, though my initial thought would be that it would cause a lot of unnecessary work on home assistant as it would be checking every hour every day, when in reality it would only be needed for a few hours once in a while.
Is there a way to maybe use a toggle to trigger a script to which will loop and check conditions and take the action until the toggle is switched off?
Make the switch the condition, and the temperature change the trigger.
That way, as long as there’s a change in temperature, automation is triggered.
If your toggle helper is ON, then it’ll perform actions. Otherwise, it’ll stop the automation.
In my opinion, you don’t need to put the temperature as the condition unless you have further requirements for that. The trigger already serves as “proof that your home is in that state”.
This will keep running each time your sensor hits the trigger, and then automation checks the condition (where helper is ON).
Example of a trigger when temp falls below 20℃:
Automatically turning off the helper
If you want the toggle helper to be turned off after lets say 60 minutes, you can then add another trigger to the same automation under a different trigger ID:
toggle helper on for duration of 1 hour
Then add an if…then action, where if triggered by the above trigger, set the toggle to off. The benefit as compared to the timer method is, your automation won’t have to keep running, and it’ll still trigger after an hour to automatically toggle your helper.
You already have a thermostat… the purpose of which is to keep the temperature in a given range. Why not have your toggle helper set the thermostat to a higher temp when turned on and back to normal when turned off?
@jeffcrum That sounds like quite an interesting way to get it to work, I shall ponder on that.
@samuelthng I hadn’t thought about doing it that way, I can see that working, I wouldn’t need the helper to be turned off as that would be something I would manually do once my guests have left for example.
Would this interfere with the normal operation of the TRV? I’m guessing not as the Wiser integration would still turn the heating on in the event that the current temp was lower than the desired temp regardless of this automation?
@Didgeridrew That’s actually pretty much how I thought the triggers worked, I just wanted to double check that I hard it right in my mind.
I had contemplated do that re setting the desired temp for the thermostat using the toggle but that TRV has it’s temperature changed quite often for various reasons so doesn’t have a ‘normal’ temp to go back to… also I fancied having a bit of a play to start using some slightly more complicated setups in HA than I’ve done before…lol
My assumptions did not include how the heating would work because nobody has heating where I live, so I’m not in the right position to suggest heating controls…
No matter the case, HA automations should be powerful enough for you to do additional processing if required for advanced conditions. Your use case sounds fairly simple.
The only other thing I’d suggest is if you want a method to restore the original value for your heater, you might need another input helper to ‘save’ the original setting (or set one to be the default to restore to in the automation - that works too).
For the second question - just add a condition for that based on your requirements.
I quite like the sound of the input helper to ‘save’ the original setting of the TRV, that could be a really god way of working it so I can just use the functionality of the directly when I use the toggle…