Scene on if weekdays and not holiday

I have no idea where you are, to see that.

The only option you have to use is “all_day” when it’s true.

And you can’t combine the conditions the way I created it. You have to keep them separate in order for the logic to work. There may be other ways of doing it but this does in fact work.

alias: Turn on light at 05:15 on weekdays (excluding holidays)
description: ""
triggers:
  - at: "05:15:00"
    trigger: time
conditions: []
actions:
  - choose:
      - conditions:
          - condition: state
            entity_id: calendar.gtfalmi_gmail_com
            attribute: all_day
            state: true
            enabled: true
        sequence:
          - stop: It's a holiday!!
            enabled: true
      - conditions:
          - condition: time
            weekday:
              - sun
              - sat
        sequence:
          - stop: Because it's the weekend!
  - data: {}
    action: scene.turn_on
    target:
      entity_id: scene.godmorgon
mode: single

The logic is as follows:

When 5:15am comes, choose between 2 actions:

  1. Is it a holiday? If yes, it stops the automation.
    or
  2. Is it Sat or Sun? If yes, it stops the automation.

Else, turn on the lights.

I succeded. I did a automation to light up.

alias: Test
description: ""
triggers:
  - trigger: time
    at: "15:29:00"
  - trigger: state
    entity_id:
      - calendar.gtfalmi_gmail_com
    attribute: all_day
    from: "false"
    to: "true"
conditions:
  - condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
actions:
  - action: script.godmorgon_micke_script
    data: {}
mode: single

Isn’t this going to activate the lights when it’s a holiday? (hence TRUE?)

    attribute: all_day
    from: "false"
    to: "true"

yes i know. just testing. Only true did not work. I wonder why…

No idea. You should try mine tho and if it works, you can always take time later to investigate it more.

Yea i will sure do so.

Eureka, It worked lika a charm. Many, many thanks for you effort.

alias: Turn on light at 05:15 on weekdays (excluding holidays) TEST
description: ""
triggers:
  - at: "15:49:00"
    trigger: time
conditions: []
actions:
  - choose:
      - conditions:
          - condition: state
            entity_id: calendar.gtfalmi_gmail_com
            attribute: all_day
            state: true
            enabled: true
        sequence:
          - stop: It's a holiday!!
            enabled: true
      - conditions:
          - condition: time
            weekday:
              - sun
              - sat
        sequence:
          - stop: Because it's the weekend!
  - action: script.godmorgon_micke_script
    data: {}
mode: single

1 Like

Hallelujah! Good to hear! Now that it’s working, you can create a duplicate and edit the duplicate to clean up the code a bit more if you want. At least you have a working one as the backup.

Done that. This was not so easy as you can think!!

I sent you a DM on here… I have a question for you…

Might be a bit too late, but the Workday integration handles both workdays AND holidays natively according to your country.

No need to check the calendar - you just need a condition like the one given at the bottom of the docs:

automation:
  alias: "Turn on heater on workdays"
  triggers:
    - trigger: time
      at: "08:00:00"
  conditions:
    - condition: state
      entity_id: binary_sensor.workday_sensor
      state: "on"
  actions:
    - action: switch.turn_on
      target:
        entity_id: switch.heater
1 Like

Hahaha. All this work for nothing. Thanx a lot for the information, installed. @ShadowFist.

1 Like

@gtfalmi, sorry! I didn’t know this existed, nor did I think to even search for something like this. But hey, the way I see it, you still learned from doing what we did. It could prove useful for something else later. So not really a waste of time entirely! :slight_smile: