Dynamic WLED preset from calendar entry description

Hello, I’m trying to get my WLED preset to be set based on the description in a calendar event.
My WLED D1mini is turned on and off daily, when it is turned on, I want an automation to check the calendar, then set the WLED preset to the same name in the calendar description.
I added a step to hardcode an option to Poppy - this works. I can also see with a template that the description from the calendar is being extracted, so I’m really confused why it doesn’t work.
Is it something to do with the datatype? YAML won’t let me enter the line without quotes but then is that parsing a string to WLED? The other option Poppy is not a string?

Thanks
Neal

alias: Roof Schedule
description: ""
triggers:
  - type: turned_on
    device_id: 82ce01d06956549fb3fc9af6376d6e13
    entity_id: a2d1e8081c31941adca89d42d59ec576
    domain: switch
    trigger: device
actions:
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - device_id: 8d886ff69c93a4fd1738c2718c3f0729
    domain: select
    entity_id: 34c0024446bb3f8d3d4c122581fa08cc
    type: select_option
    option: Poppy
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - device_id: 8d886ff69c93a4fd1738c2718c3f0729
    domain: select
    entity_id: 34c0024446bb3f8d3d4c122581fa08cc
    type: select_option
    option: "{{ state_attr('calendar.rooflights', 'description') }}"
mode: single

Device actions are designed for basic uses and do not support the use of templates. Use a select.select_option action instead.

Thankyou - so do i define a template that passes the calendar text to wled, then run the template in the automation?
I’ve never used selectors before, the docs do not come across that intuitive.

Your automation was 95% of the way there there, you just need to change the last action:

...
  - action: select.select_option
    target:
      entity_id: select.YOUR_ENTITY_HERE
    data:
      option: "{{ state_attr('calendar.rooflights', 'description') }}"

HA Docs - Select - Actions - select.select_option

Yes! fantastic, thanks

Found this and was very hopeful it was what I needed, in mine, I want to start my lights 45 mins before sunset, to prevent other automation from taking over. When I copied " line for there option update, HA stopped giving me an error so I was very optimistic. What I found this morning was an error telling me my choice was not one of my presets.

alias: Holiday Lights
description: ""
triggers:
  - trigger: calendar
    entity_id: calendar.holidays
    event: start
    offset: "0:0:0"
conditions:
  - condition: and
    conditions:
      - condition: sun
        before: sunset
        before_offset: "-0:45:00"
      - condition: device
        type: is_off
        device_id: 5282a89293d51c1039bcd62f54475336
        entity_id: e8e4a187dc8fad5f94fd1f6dbc508581
        domain: light
actions:
  - device_id: 5282a89293d51c1039bcd62f54475336
    domain: select
    entity_id: ad0614ac4390e6afabfbf80a8c9348a1
    type: select_option
    option: "{{ state_attr('calendar.holidays', 'description') }}"
  - action: notify.mobile_app_sm_s928w
    metadata: {}
    data:
      message: Holiday LIghts ran
mode: single

and here is the error I received

Error: Option {{ state_attr('calendar.holidays', 'description') }} is not valid for entity select.dig_quad_v3_preset, valid options are: Fall Colours, Thanksgiving, Goal, White, Fireworks, America, St Patricks Day, Christmas, Valentines Day, Colorwinkle, Easter, Off, Solid, Canucks, Halloween, Birthday, Canada-Day

Feels like I’m close, what did I miss?

As stated in Post #2… Device actions were designed for basic uses and inexperienced users, they do not support “advanced” features like templating.

Use the select.select_option action as shown in the post marked “Solution” with your calendar’s ID in the template and select.dig_quad_v3_preset as the targeted entity.

That is not exactly what your automation is doing… As currently configured, the automation is triggered at the start of the calendar event. If the light is off at that time and it is between midnight and 45 minutes before sunset, the actions will be executed to update the Select entity and send the notification.

If you actually want to trigger 45 minutes before sunset, use a Sun trigger.

Thanks, I see my process is flawed, that was how I had other automation trying into the calendar.

Pardon my ignorance, should this be as a template rather than an automation?

I’m not sure what you are asking… it might be best to start a new thread describing what you are trying to accomplish. Make sure to include what you have already tried and detail any complicating factors like the “other automation” you mentioned earlier.

ok I apologize for this, I will open a new ticket after I wrap my head around this a little, I will explain what I’m hoping to do and then can take direction from there.

Brett