I would like to be able to turn on/off several automations at once and add this as a switch in Lovelace. I have tried adding them to groups.yaml (I know, this method is deprecated) because I cannot find a way to add automations at all in Helpers/Groups. When adding them to groups.yaml, only the last one shows up and it’s ID is oddly named group.group. It does work, btw, but as I said, it only gives me one out of the three I created.
Is there a way to do this? I am sure there is, I just have not found it yet.
Automation can only be grouped using the legacy group method. You need to share your configuration for us to tell you what has gone wrong with your groups.
FWIW, many experienced users would advise that you use conditional logic inside the automations to control when they perform their actions instead of turning them on and off. This is especially true if your plan is to automate tuning the groups on and off.
I don’t plan on using these in any automations, just manual toggle whenever I need them turned on/off. Usually just on occasions where I have lots of company. For instance, my talking motion detectors in the hallway and driveway would be turned off whenever I have several people over. Here is my groups.yaml:
Oh nice! I will give this a try later and report back. I have to run out for a bit really soon. I had tried adding an id: field, but it totally rejected it. Thank you!
After 5 years of using Home Assistant, I was hoping to hear a good reason for automating the process of turning off automations but I haven’t heard one yet.
Create an Input Boolean and add a State Condition to your automations that confirms the Input Boolean is on. If you ever want to prevent your automations from executing their actions, simply turn off the Input Boolean (think of it as a 'master cut-off ’ switch). This is commonly done for things like “visitor mode” or “vacation mode”.
This method still leaves you option of manually turning off an individual automation for debugging purposes (i.e. it’s misbehaving and you need to disable it until you have the time to debug it) or for versioning (i.e. disable an older version of the automation while testing a newer version of it).
Basically, an automation should be designed to always be enabled and make its own decisions. Disabling an automation should be a last resort, reserved for maintenance purposes.
A vast majority of my automation scheme is based on checking if “something” is enabled, like vacation mode, am i awake (TTS notifications) and so forth. The only things I have that actively enable/disable automation were off-the-cuff things I wanted to get done right away and didn’t want to go to the trouble of creating a condition for it, then I generally fix it as soon as I have the time because it becomes a nightmare to manage the ever changing automations that you would have to disable.
This isn’t to say that doing it this way is beyond the pale, don’t get me wrong - to each their own - but eventually you are likely to regret it when it bites you in the future.
I once had all my groups inside of configuration.yaml but moved them out a few years ago once I discovered groups.yaml. I’ll try removing the group: key and see what happens.
I actually do have an automation that enables/disables another automation. My driveway motion sensor is separate from the lights themselves. I don’t want the driveway lights to be turning on during the day light hours during motion detection so I have an automation that enables the motion sensor automation at sunset and turns it back off at sunrise. I am pretty sure I could just build that into the motion sensor automation but this has been working well for over a year now so I have not taken the time to “fix” it.
EDIT-The reason I did this is because the motion sensor automation was made from a Blueprint and I cannot really add additional conditions to it, at least that I know of, so I was kinda stuck with it.
Thank you Taras. Everyone here seems to be in agreement that States are the best way to do this. I will read up on the State Condition link you sent and try to get a grip on it ASAP.