Outdoor Light Automation Not Working Looking for help

I have automation to turn on my outside lights 30 minutes after sunset and turn them off again at 1030. It is a little complicated because I have a few scenes that the automation can choose from depending on the holiday. If there is a defined holiday, it turns on the specified holiday scene. If it’s not a holiday, it should turn on the outside lights to a bright scene. So, strangely, the automation works perfectly for the holiday scenes. It worked perfectly for the week of Halloween, but for the default, it doesn’t activate at all. The automation triggers, but the bright scene never comes on. The Holiday dates for the scenes are defined in the config.yaml. Am I missing something for the automation for the “nonholidays”?

alias: Turn on Outdoor Lights After Sunset
description: Turns on outdoor lights 30 minutes after sunset, with holiday scenes.
triggers:
  - trigger: sun
    event: sunset
    offset: "+00:30:00"
conditions: []
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ states('sensor.current_holiday') != 'None' }}"
        sequence:
          - action: scene.turn_on
            target:
              entity_id: >
                {% set holiday = states('sensor.current_holiday') %} {% if
                holiday == "New Year's" %}
                  scene.holiday_new_years
                {% elif holiday == "Valentine's Day" %}
                  scene.holiday_valentines
                {% elif holiday == "St. Patrick's Day" %}
                  scene.holiday_st_patricks
                {% elif holiday == "4th of July" %}
                  scene.holiday_4th_of_july
                {% elif holiday == "Halloween" %}
                  scene.holiday_spooky
                {% elif holiday == "Thanksgiving" %}
                  scene.holiday_thanksgiving
                {% elif holiday == "Christmas" %}
                  scene.holiday_christmas
                {% else %}
                  scene.outside_bright  # Default scene
                {% endif %}
    default:
      - action: scene.turn_on
        target:
          entity_id: scene.outside_bright
        data: {}
mode: single

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

It is difficult to tell because your automation is not formatted correctly for the forum but it sort of looks like default: is not indented correctly:

I do apologize I didn’t realize I didn’t put in the three ``` and instead used ’ I edited the post so it shows correctly now.

Thanks, indentation looks good.

Are you setting this sensor to the string “None” when there is no holiday?

Or are you using an empty string "" or null ?

If the latter, try this instead:

value_template: "{{ states('sensor.current_holiday')|has_value }}"

Yes i had it in there to trigger if it wasn’t a holiday. I put your suggestion in and will see if triggers tonight. Thank you for the help!

Yes I know but we need to know the actual value of sensor.current_holiday when there is no holiday to make the template work. What is it?

String, empty string, or null?

Go to Developer Tools → States, find your entity and look what the value is now (assuming it is not a holiday now).

Or

Go to Developer Tools → Template and find out what this returns:

{{ states('sensor.current_holiday') }}
1 Like

That worked perfectly! Thank you for the help!

The state of it right now is unknown. I did see during Halloween week it came back with a state of holoween.