WLED house lighting

Hello all, I currently have my house lights come on at certain times, I want to add in the ability to set holiday lights, to run on the same schedule.

I have a calendar with entries and the option corresponding to the preset I want to select.

I am still fairly new to home assistant and know I’m shooting above my level.

So I accept I might be coming from the wrong direction,

Here is the idea at high level

Sunset, see if there is an entry on the holiday calendar, if true set the output to be the value from the calendar entry.

how would YOU recommend this?

Let’s back up. Are your holiday lights installed yet. If so how do. Your activate them…

Let’s work backwards from there.

They are saved presets within WLED

The first learn how to do an automation to fire a saved preset.

Next. You need to have something for your calendar (I use the Google calendar integration but you an use any calendar)

Next your trigger. Sounds like a time based trigger (your dusk event)

At that point read the state of your sensor containing the calendar data and then react use it to fire the appropriate light. Turn_on service call… Shouldnt be too hard. Start with working on just triggering on dusk when the calendar is present then move on to firing the RIGHT wled program.

Ok here is my automation that just ran a little while ago

alias: Sunset White LED
description: ""
triggers:
  - event: sunset
    offset: "-00:30:00"
    trigger: sun
conditions:
  - condition: or
    conditions:
      - condition: device
        type: is_off
        device_id: 5282a89293d51c1039bcd62f54475336
        entity_id: e8e4a187dc8fad5f94fd1f6dbc508581
        domain: light
      - condition: device
        device_id: 5282a89293d51c1039bcd62f54475336
        domain: select
        entity_id: ad0614ac4390e6afabfbf80a8c9348a1
        type: selected_option
        option: "Off"
actions:
  - device_id: 5282a89293d51c1039bcd62f54475336
    domain: select
    entity_id: ad0614ac4390e6afabfbf80a8c9348a1
    type: select_option
    option: White
mode: single

My plan will be a separate automation that will run ahead of this, so next need to be able to read if there is an entry with today’s date, then pass that description as the option to fire

the calendar integrations generally report a binary sensor if the calendar item matching pattern X is on. So you can use this to your advantage.

You could have different calendar entries that turn on and off the entries like a light switch. Youd just have to handle conflicts in scheduling gracefully.

Here’s more info on how calendar entities work: Calendar - Home Assistant (note the light schedule sample)

Ok I have the automation setup but now have a question about holding the important data I need.

I access the calendar as a condition checking to see if it is true.

The description is where the important information is.

Is this connection considered to be open? Is the response function valid? Should I assign the value to a variable that can be used to pass to my WLED?

Feels like once I know this step, I’ll be set

alias: Holiday Lights
description: ""
triggers:
  - trigger: calendar
    entity_id: calendar.holidays
    event: start
    offset: "0:0:0"
    enabled: false
  - trigger: sun
    event: sunset
    offset: "-00:45:00"
  - trigger: time
    at: "22:01:00"
conditions:
  - condition: and
    conditions:
      - condition: device
        type: is_off
        device_id: 5282a89293d51c1039bcd62f54475336
        entity_id: e8e4a187dc8fad5f94fd1f6dbc508581
        domain: light
        enabled: true
      - condition: state
        entity_id: calendar.holidays
        state: "on"
actions:
  - device_id: 5282a89293d51c1039bcd62f54475336
    domain: select
    entity_id: ad0614ac4390e6afabfbf80a8c9348a1
    type: select_option
    option: "{{ target.calendar_event.description }}"
  - action: notify.mobile_app_sm_s928w
    metadata: {}
    data:
      message: Holiday LIghts ran
mode: single

Here is a tidbit of code that will select a preset in WLED. Replace the “YOUR_TEXT_HERE” with the name of the preset in WLED.

        - action: light.turn_on
          data:
            entity_id: light.wled_house_master
        - delay: "00:00:10"
        - action: select.select_option
          target:
            entity_id: select.wled_house_preset
          data:
            option: "YOUR_TEXT_HERE"
1 Like

Thanks Art, but that is my issue, I confirm hardcoding a preset name causes it to run correctly. The problem I’m looking to automate and use the data found on the calendar, which I already check to confirm that the day is correct to run these lights

So are you pulling the name of the preset from the calendar? That doesn’t seem like the most efficient way to go about it. I use WLED and control all my lighting using automations and scripts to select the correct preset at the correct time/date. This allows my lighting to work regardless of Google Calendar/Internet connections or other access issues.
For example, here is the Halloween automation and script:

#################################################################
# Halloween Lights On
#################################################################
- id: halloween_lights_on_at_sunset
  alias: Halloween Lights On at Sunset
  initial_state: TRUE
  mode: restart
  triggers:
    platform: sun
    event: sunset
    offset: '00:00:05'
  conditions:
  - condition: state
    entity_id: input_boolean.halloween_lighting
    state: 'on'
  actions:
  - action: script.turn_on
    entity_id: script.halloween_script
  - action: script.turn_on
    entity_id: script.notify_hass_halloween_lights_on_at_sunset
  - action: script.turn_on
    entity_id: script.notify_push_halloween_lights_on_at_sunset
#
#################################################################
# SCRIPT: Halloween
# Called from [halloween_lights_on_at_sunset]
# In file: [automations/lights_holiday.yaml]
# Called from [id: porch_light_reset_color_pm]
# In file: [automations/lights_triggered.yaml]
#################################################################
halloween_script:
  alias: Halloween Script
  mode: restart
  sequence:
# INSIDE
    - action: light.turn_on
      data:
        entity_id: light.sunroom_led
        brightness: 30
        rgb_color: [255, 0, 250]
    - action: light.turn_on
      target:
        entity_id:
          - light.outdoor_plug_zw050_1
          - light.outdoor_plug_zw050_2
          - light.tv_left
          - light.tv_right
      data:
        brightness: 128
        rgb_color: [211, 87, 255]
# OUTSIDE
    - if:
        - "{{ states('sensor.sun_elevation')|float < 5 }}"
      then:
        - action: light.turn_on
          data:
            entity_id: light.wled_house_master
        - delay: "00:00:10"
        - action: select.select_option
          target:
            entity_id: select.wled_house_preset
          data:
            option: "{{ states('input_text.halloween_day_wled') }}"
        - action: light.turn_on
          target:
            entity_id:
              - light.front_porch
          data:
            brightness: 190
            rgb_color: [255, 201, 68]
        - action: light.turn_on
          target:
            entity_id: light.gar_led_east
          data:
            brightness: 128
            rgb_color: [171, 48, 255]
        - action: light.turn_on
          target:
            entity_id: light.gar_led_center
          data:
            brightness: 128
            rgb_color: [171, 48, 255]
        - action: light.turn_on
          target:
            entity_id: light.gar_led_west
          data:
            brightness: 128
            rgb_color: [171, 48, 255]
#

Right, I’m not wanting to tie to google and using my local calendar.

I have my local calendar set with annual events set with the preset name in the description.

I’ve not done anything with scripts but I’ve never been against the idea of using scripts.

So do you have multiple scripts defined for whatever type of lights you want lit up?

Yes, I have about 12 or 13 automations/scripts that cover all the holidays we have custom lighting defined for in WLED. If it is not a holiday, then I revert to a seasonal color preset. I also calculate the NEXT occurrence of the particular holiday once the current holiday ends, so… NO manual config necessary, EVER. If I change a color scheme in WLED, I simply update the preset name in my dashboard. See pics



Automations manage the entire process, from setting the correct season or holiday to populating the correct preset to WLED. Yes, it may seem like a lot of coding, but it is 100% self sufficient and I don’t need to touch it at all (unless I change/add a color scheme).
I use input booleans as the on/off for a holiday and a select and input_select for the preset. The first comes from WLED and the second is populated in manually (once). Look at the first pic Holiday Colors box. It’s the last two items. All my lighting can then be pushed to a mini grid where it is easy to see when things will occur.
My Presets:

Wow nicely done… I’m far from that level, but that’s the great part about programming, there are many ways to get to the same point.

I commend you on what you’ve accomplished here, I think once figure out what in trying to do will be easier than starting over, but need to work on looking into scripting sooner than later.