Automation with light color change?

Hello, in an automation I would first like to determine what the current light color and brightness is, then change the color briefly and then return to the original color and brightness. Does anyone have any idea how I can do it? Can I somehow buffer the original state and then call it up again. In a variable maybe?

1 Like

Sounds like a good use for the scene.create (with snapshot_entities) and scene.apply services:

1 Like

Excellent tip!!! I’ll try it! :+1: :hugs:

Works perfectly for me! Thank you sooooooooooo much!!!

If the air quality becomes bad, a snapshot of light.wohnzimmer is taken, light color changes to red and flashes for 5 seconds. Then the original state is restored.

- id: '1583592897036'
  alias: Wohnzimmer Luftqualität schlecht
  description: ''
  trigger:
  - entity_id: input_boolean.elgato_eve_room_bad
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: or
    conditions:
    - condition: zone
      entity_id: person.one
      zone: zone.home
    - condition: zone
      entity_id: person.two
      zone: zone.home
  action:
  - data:
      scene_id: before
      snapshot_entities: light.wohnzimmer_mitte
    service: scene.create
  - data:
      brightness_pct: 100
      color_name: red
      entity_id: light.wohnzimmer_mitte
      flash: long
    entity_id: light.wohnzimmer_mitte
    service: light.turn_on
  - delay: 00:00:05
  - data: {}
    entity_id: scene.before
    service: scene.turn_on
7 Likes

Hey thats exactly what I was looking for.
I got one issue tho.

I want the light to flash continuously for 10s.
Right now it only flashes once and then stops for the rest of the time.
Copied your YAML.

Any Ideas?