Hello all,
I have an automation that starts the heating when the temperature drops below 18 °C. When the whole family is away from home, HA deactivates (turn_off) this automation and when someone returns home, the automation becomes active again. The problem is that if in the meantime the temperature has dropped to 16 °C and remains stable, the trigger does not work because the state has not changed since the automation was started. Is there a way to start the trigger automation from code so that it still goes to test the temperature and behave accordingly with it?
Thanks.
Simpler, don’t turn it off
Trigger:
- Temperature dropping below 18
- The
group
of the family becominghome
Condition:
- The temperature is below 18
- The
group
ishome
Turning automations on and off is almost always the wrong approach
Hello @Tinkerer ,
thank you for reply. Your solution would be excellent if this were the only thing I had to manage in case of absence / presence of the family group. But since I have several things to activate / deactivate, in this case I prefer to be able to manage all these operations (lights, alarms, doors, etc.) from a single automation to have everything under control and not forget anything. However, I imagine there must be something that behaves like the “run actions” button next to the automation list (Configuration> Automations) in order to trigger the automation. Thanks.
Your first post didn’t mention anything beyond controlling heating.
Post the entire automation so we can offer suggestions.
Hello @123 ,
thanks for reply. The automation is still under construction, but essentially activates and deactivates a sequence of automations, switches and more, whether the family group is at home or away from home. However, I was only interested in knowing whether or not there is something that triggers an automation from the code, overcoming the trigger inside of it.
Thank you
The automation.trigger
service call lets you manually trigger an automation (and optionally include/exclude the automation’s condition
).
However, if you have decided to build a system that relies on turning automations on/off and triggering them via automation.trigger
then you’re using two well-known anti-patterns (i.e. flawed design techniques). That’s why I had suggested you post what you currently have so we can make design recommendations (that don’t use anti-patterns).
I think that Taras has a very good recommendation and some people might be able to propose an “architecture” that is much more manageable for you.
On top of that, it sounds like this heater thing should probably be a thermostat. If it isn’t already, you could make one with a generic thermostat, and just set it to away mode when people go away, and set it to whatever temperature you like when people are home.
Hello all,
thanks for your reply.
Regarding the thermostat, it is set in frost mode if there is no one in the house and in auto mode if there is at least one presence. Now I’m trying to solve a problem concerning the presence or absence of the family. In some cases the device_tracker of the cell phones of the single family members, in addition to returning ‘home’ and ‘not_home’ also replies to me ‘unavailable’, but I have not yet been able to understand when. The problem arises when someone is at home, because the family group gives me ‘not_home’ (not ‘unavailable’) creating many problems. I can’t even pair a gps zone because not all smartphones have the HA app installed.
Thanks anyway for all the advice you have given me.