Save the Color of lamp and use it later

Hello,
i want to change my lamp to one color and after 10 sec back to the old color. how do I do that. currently I only switch off the lamps.

alias: Haustür öffnen Auto Off
description: ""
trigger:
  - platform: state
    entity_id:
      - switch.haustur_offnen
    to: "on"
condition: []
action:
  - if:
      - condition: state
        entity_id: group.personen_wohnung_anwesend
        state: home
    then:
      - service: light.turn_on
        data:
          rgb_color:
            - 0
            - 255
            - 0
          brightness_pct: 100
        target:
          entity_id:
            - light.flur
            - light.spotlight
            - light.dusche_hinten_rechts
            - light.kuchenzeile
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.haustur_offnen
  - if:
      - condition: state
        entity_id: group.personen_wohnung_anwesend
        state: home
    then:
      - service: light.turn_off
        target:
          entity_id:
            - light.flur
            - light.spotlight
            - light.dusche_hinten_rechts
            - light.kuchenzeile
mode: restart

Create a scene on-the-fly. Do your thing. Restore the created scene.

https://www.home-assistant.io/integrations/scene/#creating-scenes-on-the-fly

1 Like