Automation Keeps Getting Deactivated

Hi Everybody,

my wife wants to have an ‘all off’-button for the lights in one room.
Me: Piece of cake…
of course, I’m stuck now.

Situation:
Room is equipped with Shellies, Dimmer2, RGBW2 and PlugS; FW is updated on all devices.

Attempt1:
Make a group, switch it off, ready. Does not work, because PlugS is a switch and Dimmer/RGBW2 are lights. So, I made the PlugS a light with a helper. Did not respond anymore. HA Restart did not help.

Attempt2:
Create an automation having the actions of switching off the desired Shellies. No, trigger, no condition, since I just want to call it from the frontend.Does not work either, because the automation gets deactivated every time it is called. Ii also tried to set a dummy trigger (an unconnected button of an I4); it keeps getting deactivated.

I know, I am not an experienced programmer, but is my approach basically wrong or did I just oversee anything?

Thanks for your time

That is not an automation… that’s an error message waiting to happen. Automations must have triggers. If you have a sequence of actions that you need to be able to call, but you do not want to set up a specific trigger, you need to set it up as a script.

There are a few ways to do what you want.

One option would be to use Old Style groups. These YAML-configured groups allow mixing switches and lights. Then your script or dashboard button tap-action would include the generic homeassistant.turn_on, homeassistant.turn_off, or homeassistant.toggle.

service: homeassistant.turn_off
data: {}
target:
  entity_id: group.example_room_lights

Another option would be to create a scene that includes all the entities in an ‘off’ state. and have your button activate that scene.

1 Like

Ok, I was afraid that the problem is sitting in front of the console. With your valuable information, I went a little bit through the differences between automations, scripts and scenes, which - only at first sight - seem to be quite similar.

Now, I was able to get my automation to work and I can think about different approaches to those tasks.

Thanks again for your time and the very detailed answer.

While that works you don’t need to use a group to use “homeassistant.turn_x”.

it will work the same way by just using a list of entities:

service: homeassistant.turn_on
entity_id:
  - light.some_light
  - switch.some_other_switch