#Annual scene automation

1 messages · Page 1 of 1 (latest)

slender hollow
#

Hi gang. Apologies off the bat if this is in the wrong section to post...Quick question...I have the following automation which uses two helpers I set up, Halloween Start(with a date of 10/1/2024), and Halloween End(with a date of 10/31/2024)...Issue comes into play that I cant set the helper, or at least not that I know of, to use the current year so I dont have to go in after each October and change the year to the next. Is there a way to set the year as current in the helper, or do I need to get rid of the helper altogether and just add something like "10/1/*" and "10/31/"?

alias: Halloween Automation
description: ""
triggers:

  • trigger: sun
    event: sunset
    offset: "00:10:00"
    conditions:
  • condition: time
    after: input_datetime.halloween_start
    before: input_datetime.halloween_end
    weekday:
    • sat
    • fri
    • thu
    • wed
    • tue
    • mon
    • sun
      actions:
  • action: scene.turn_on
    metadata: {}
    target:
    entity_id: scene.turn_outside_lights_orange
    mode: single
dusky plover
#

You can use a template condition:

conditions:
  - condition: template
    value_template: |-
      {{ now().month == 10 and now().day <= 31 }}
#

Well, as the 31st is the last day, the month should be sufficient

conditions:
  - condition: template
    value_template: |-
      {{ now().month == 10 }}
queen topaz
#

Or a free service like calendarific as well.

agile bridge
#

Couple of methods you could use for this
The holiday integration has a bunch programmed in so you can check if the entity is on and the message is "Halloween"
You can also do a check if now().month == 10 and now().day == 31
You could have an automation which updates your sensors when the halloween end sensor turns from on to off, it adds a year to both

queen topaz
#

_Basically a million ways to skin the cat 😉 _

slender hollow
#

Awesome. Really appreciate the quick feedback. Funny how I do VBA coding in excel for automations and I say the same thing, always multiple ways to reach the same result....HASS is no different. Much obliged.

queen topaz
#

lmao... but ew @ VBA. Stop that 😉 hahaha (but also same for work; it's horrid and I want to bang my head on the desk)

agile bridge
#

I had to rewrite a lovely bit of python I made for work into vba in access because the finance people didn't want to install "snake software"

queen topaz
#

lol yeah, I feel that. We allow external customers to download excel "templates" and fill them out and upload them to us. So, can't use anything BUT VBA for the macros and such. It's horrible and I hate life every time I have to touch them.

slender hollow
#

Im reading all this and just glad im not the only one that feels that way. Lol.

queen topaz
#

I remember a few years back when MSFT was going to let you swap out VBA with IronPyton and I was like "MY BODY IS READY" and then MSFT was all like "April Fools!!!" and "Nah, we don't want to do that anymore"... I was sad.

slate granite
#

I do a trigger template sensor for the year end holiday season, including the 12 days after the 25th...

- trigger:
    - trigger: time_pattern
      id: This will it update every night
      hours: "0"
      minutes: "0"
    - trigger: homeassistant
      id: This will update it at HA start
      event: start
  sensor:
    - name: "xmas_season_enable"
      unique_id: c50d6efc-dc19-4f85-b04a-21fa74bba5fe
      state: >
        {% set today = states('sensor.date').split('-') %}
        {% set month = today[1]|int %}
        {% set day = today[2]|int %}
        {{ month > 10 or
            month == 1 and day <= 5 }}
      availability: >-
        {% from 'availability_template.jinja' import avail %}
        {{- avail(['sensor.date']) | bool -}}
      attributes:
        friendly_name: "Christmas Season Enable"
queen topaz
#

You kids and your non-complicated stuff... lol I went... overcomplicated.

slate granite
#

The problem is that means my lights should be turning on today...
But they are still in the attic in a box...

bright night