#Alias/Variables in automations

1 messages · Page 1 of 1 (latest)

storm geyser
#

Is it possible to set variables in automations so I don't have to change them in the rest of the automation and instead can use the variables/alias?
Basically I want to have 4 variables with Light or a light group and call the actions "turn on/off" or "increase/decrease brightness".
But I want to be able to easily change the lights and not change them like 4 times in the automation. In the automation below for example, I want to replace the sequence with the light entity or light group defined in the variables.

To give you some more context: I have a philips hue tap dial.

  • On button press I want to set a light group/turn them on
  • on hold I want to turn off the light
  • on rotate the dial I want the previously turned on light group to change the brightness
alias: Philips Hue Tap Dial
description: ""
triggers:
  - domain: mqtt
    device_id: XXXXXXX
    type: action
    subtype: brightness_step_up
    trigger: device
    id: BRIGHTNESS_UP

conditions: []
actions:
  - alias: BRIGHTNESS
    choose:
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id:
                  - BRIGHTNESS_UP
              - condition: state
                entity_id: input_text.light_group_tap_dial
                state: "1"
        sequence:
          - device_id: a4b00f95ff9791d6fceffc18dddddd
            domain: light
            entity_id: f779272a94df2bc2083edddddddddd
            type: brightness_increase
mode: parallel
max: 10
dreamy thorn
#

Also, unrelated: conditions are logical and by default. The only reason the and building block exists is so that you can nest it inside another block (like or or not).

In your automation it’s not harmful but it is superfluous.

storm geyser