Automation phone call

Hello,

I have created 2 automations which turns on wled with special settings to announce a phone call.
After switch to talking or idle again automation2 restors my standard settings and turns wled off.
Can I somehow save the previos state of wled and restore after phone call? So when wled is turned on befor phonecall turn it on again and when off --> off.

automation1

alias: Festnetz Licht Blinken
description: Wenn das Festnetz klingelt soll das Licht blinken
trigger:
  - platform: state
    entity_id: sensor.festnetz
    from: idle
    to: ringing
condition: []
action:
  - type: turn_on
    device_id: d88ce9f061454620a6f085a5c0e44e33
    entity_id: light.wled_monitor
    domain: light
    brightness_pct: 20
  - service: wled.effect
    data:
      effect: blink
      speed: 200
      intensity: 200
      palette: 48
    entity_id: light.wled_monitor
mode: single

automation2

alias: Festnetz Blinken wieder ausschalten
description: ''
trigger:
  - platform: state
    entity_id: sensor.festnetz
    from: ringing
    to: talking
  - platform: state
    entity_id: sensor.festnetz
    from: ringing
    to: idle
  - platform: state
    entity_id: sensor.festnetz
    from: talking
    to: idle
condition: []
action:
  - service: wled.preset
    data:
      preset: 2
    entity_id: light.wled_monitor
  - type: turn_off
    device_id: d88ce9f061454620a6f085a5c0e44e33
    entity_id: light.wled_monitor
    domain: light
mode: single

Best regards,
Stefan

Hey Stefan,

there’s no service like sonos.restore, maybe as a custom integration, however I’m not aware of one.
If you have a bit of time on your hands, you could set up a (virtual) Template Light with all the attributes your WLED supports. Have the turn_on and turn_off action do nothing.
You could then create a snapshot script which sets the state and attributes with a templated light.turn_on call (or turn_off when the original state is off) like this

service: light.turn_on
entity_id: light.virtual_wled
  data: 
    brightness: {{ state_attr('light.mywled', 'brightness') }}

and so on.
The restoring script would be the same except now the WLED is set the states from the virtual wled.