Automation - save current LED setting and reuse them at the end

Hello all,

I’m still quite new with the HomeAssistant and get by with the many help here in the forum very well. Only sometimes you do not find exactly the topic where I need help. Therefore here a new topic :wink:

I have a LED strip in my smart home. In some automations I let the LED strip light up in a certain color. This is visual information for me, which is very important.

What I am missing now: I would like that the LED strip is set again after the automation as it was:

These values are decisive:
state: ON
brightness: 12
color_mode: xy
color: x: 0.4066, y: 0.1643
color_temp: 153

How can I read these values in an automation and save them temporarily so that I can use them again later in the same automation?

Greetings,
Ulrich

I use the scene create service to take a snapshot before I do stuff and then call it when I’m done to put things back they were before.

Scroll down to “Creating scenes on the fly”

2 Likes

Yes - the “scene.create” and the “scene.turn_on” was the missing knowlegde at my side :wink:

The working automation:

alias: am deurbelbericht en lichteffect op zolder
description: ""
trigger:
  - type: vibration
    platform: device
    device_id: de434b994953bab3c6cf2fc0cd384625
    entity_id: binary_sensor.vs_01_vibration
    domain: binary_sensor
condition: []
action:
  - service: scene.create
    data:
      scene_id: before
      snapshot_entities: light.ll_01
  - service: notify.mobile_app_smartphone_ulrich_s22
    data:
      message: Deurbel
      title: Let op
  - repeat:
      count: "10"
      sequence:
        - service: light.turn_on
          data:
            brightness: 255
            rgb_color:
              - 255
              - 0
              - 0
            transition: 0
          target:
            entity_id: light.ll_01
        - delay:
            hours: 0
            minutes: 0
            seconds: 2
            milliseconds: 0
        - service: light.turn_on
          data:
            brightness: 255
            rgb_color:
              - 0
              - 128
              - 255
            transition: 0
          target:
            entity_id: light.ll_01
        - delay:
            hours: 0
            minutes: 0
            seconds: 2
            milliseconds: 0
  - service: scene.turn_on
    data: {}
    target:
      entity_id: scene.before
mode: single