How to group many automations

Hi,
I have a set of automations related to my car charger. How do I group them in some sensible way instead of having 10 automations witht he same prefix ?

What is the obvious choice for many automations working on the same physical set of objects (car + charger + solar) ? Blueprints will expose lots of individual automations. Even folders in Automations would help me keep an overview.

I have other stuff as well, say dimmer_up and dimmer_down functions - To be called on different lights, and volume_up/down/mute/channel_up/down on a radio. All working on the same “set” of entities.

If I could get Node Red to work correctly with my triggers, it would be obvious to put it in there. Group lots of stuff on the same page. All my dimmer_up buttons calls the same function after setting target entioty ID.

You can’t
It’s one of the most popular ‘feature requests’, but we still don’t have such an option

As a workaround you can do all your related automations as a single automation.
For example, instead of creating two automations for dimmer_up and dimmer_down, create one for the remote with both dimmer_up and dimmer_down as triggers with different ids. Then use the choose action to run correct action for the trigger. Reworking all my automatins like this massively cut down on number of automations and made the UI usable again.

Is this really the level of detail that should be put in automations? I do it myself but I always considered hardwiring these in detail to be a hack. E.g. I made one automation specifically for one media device to stop, so that I can make it sort-of a button in the UI.

In general I am quite frustrated that the simple thing of “playing radio” requires so much coding as a user.

Can you link or provide an example screenshot?

This is for roller shades, but the principle is the same.

There are 4 triggers, each with their own id. Note that I only have 2 id’s so 2 triggers are for closing and 2 are for opening.

The choose looks at the id and performs the respective actions.

Hope this helps!

automation: 
  - alias: "Aqara: Open/close roller shades"
    id: aqara_roller_shades_open_close
    description: ''
    mode: single
    trigger:
      - platform: state
        entity_id: sensor.light_level
        to: "Night"
        id: 'close'
      - platform: state
        entity_id: sensor.light_level
        from: "Night"
        id: 'open'
      - platform: state
        entity_id: input_select.house_mode
        to: "Awake"
        id: 'open'
      - platform: state
        entity_id: input_select.house_mode
        to: "Asleep"
        id: 'close'
    action:
      - choose:
          - conditions:
              - condition: trigger
                id: 'open'
              - condition: state
                entity_id: input_select.house_mode
                state: Awake
              - not:
                  - condition: state
                    entity_id: sensor.light_level
                    state: Night
            sequence:
              - service: script.turn_on
                target:
                  entity_id: script.aqara_roller_shades_open
          - conditions:
              - condition: trigger
                id: 'close'
            sequence:
              - service: script.turn_on
                target:
                  entity_id: script.aqara_roller_shades_close

1 Like

Needs some code refactoring, but seems like something that is doable for some automations.

It’s only an example of how to use multiple triggers and multiple actions per @Pajn’s suggestion.

I was saying my code needs re-factorization.

Here is my new 3-in-1 button+timer control of zigbee joining.
I can now remove 2 automations.

And I can see the idea of using blueprints now that I need to create only 1 blueprint to automate all aspects of something. This is really a step forward in many ways. Not just for cleaning up clutter

alias: Enable Zigbee joining
trigger:
  - platform: state
    entity_id: input_boolean.zigbee_permit_join
    to: "on"
    id: "on"
  - platform: state
    entity_id: input_boolean.zigbee_permit_join
    to: "off"
    id: "off"
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.zigbee_permit_join
    id: "off"
action:
  - choose:
      - conditions:
          - condition: trigger
            id: "on"
        sequence:
          - service: mqtt.publish
            metadata: {}
            data:
              retain: false
              topic: zigbee2mqtt/bridge/config/permit_join
              payload: "true"
              qos: 0
      - conditions:
          - condition: trigger
            id: "off"
        sequence:
          - service: mqtt.publish
            metadata: {}
            data:
              qos: 0
              retain: false
              topic: zigbee2mqtt/bridge/config/permit_join
              payload: "false"
          - service: input_boolean.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: input_boolean.zigbee_permit_join
1 Like

got it - sorry for the misunderstanding.

Seems much was improved with the new 2024.1 release :partying_face: which now abstracted away the call_service steps, and more UI improvements for configuring Automations.

And remember, all the code above could be used with simple actions.
To me this method seems to work. Did not make a custom blueprint yet, but it will help.

I am converting my whole house to zigbee switches, and having many triggers in these actions are great. I can have button 27 and 3 both use the same id - which will do the action associated with that ID.

Combining with variables, you can even set the target entitity ID in the top of the automation Not sure if it requires YAML or works in GUI

So “id: on” on multiple triggers, and then the on action below. Same as having multiple trigger nodes in Node-Red (which if for even simpler programming)