Are "yaml-aliases", the "&"-function allowed in configuration.yaml

hello,

is the “&” allowed as described here:
https://github.com/cyklo/Bukkit-OtherBlocks/wiki/Aliases-(advanced-YAML-usage)

best regards, Stef

1 Like

Yes :slight_smile:

Sounds interesting.
Do you have a good use case for it?

I use this for my milights:

light: 
  - name: "Plafond"
    command_topic: milight/commands/0x578/rgb_cct/1
    state_topic: milight/states/0x578/rgb_cct/1
    <<: &MILIGHT_PARAMS
      platform: mqtt_json
      brightness: true
      rgb: true
      color_temp: true
      effect: true
      effect_list: [ 0, 1, 2, 3, 4, 5, 6, 7, 8]
      optimistic: false
      qos: 0
      xy: false
      retain: true
  - name: "Spot"
    command_topic: milight/commands/0x578/rgb_cct/2
    state_topic: milight/states/0x578/rgb_cct/2
    <<: *MILIGHT_PARAMS
  - name: "Keuken"
    command_topic: milight/commands/0x578/rgb_cct/3
    state_topic: milight/states/0x578/rgb_cct/3
    <<: *MILIGHT_PARAMS
  - name: "Aquarium"
    command_topic: milight/commands/0x579/rgb_cct/2
    state_topic: milight/states/0x579/rgb_cct/2
    <<: *MILIGHT_PARAMS
  - name: "Badkamer"
    command_topic: milight/commands/0x578/rgb_cct/4
    state_topic: milight/states/0x578/rgb_cct/4
    <<: *MILIGHT_PARAMS

etc

5 Likes

great and thanks for the example !!

1 Like

Great stuff. Using it in ui-lovelace.yaml now and that is working great for cards which I use multiple times on different tabs :grinning:

Example

aliases:
  - &THERMOSTAT_BUTTONS
    - type: horizontal-stack
      cards:
        - type: "custom:button-card"
          color_type: blank-card
        - type: custom:button-card
          # entity: script.bedtime_ac
          icon: mdi:gesture-tap
          color: 'var(--accent-color)'
          size: 20%
          name: Comfortstand 20°C
          style:
            - font-weight: bold
            - color: 'var(--primary-text-color)'
          action: service
          service:
            domain: climate
            action: set_operation_mode
            data:
              entity_id: climate.ethermostaat
              operation_mode: 'Comforstand'
        - type: "custom:button-card"
          color_type: blank-card
        - type: custom:button-card
          icon: mdi:gesture-tap
          color: 'var(--accent-color)'
          size: 20%
          name: Bespaarstand 17°C
          style:
            - font-weight: bold
            - color: 'var(--primary-text-color)'
          action: service
          service:
            domain: climate
            action: set_operation_mode
            data:
              entity_id: climate.ethermostaat
              operation_mode: 'Bespaarstand'
        - type: "custom:button-card"
          color_type: blank-card

And then you can simply use on the tabs where you want these buttons to show up.

- <<: *THERMOSTAT_BUTTONS