Disable automations for halloween

I have an automation that turns on some outdoor lights at sunset, and automation that turns on lights based off of motion detection. I would like a way to disable both automations for Halloween, we will be gone and don’t want trick or treaters coming up to the house because outdoor lights are on

1 Like

You can just click at the 3 dots menu at the right and select “Disable”.
Another option is to add a condition and then set to not run that day.
Or, the one I like more (and I use a lot on my automations) to have some helper to set a Halloween mode (I have for Party mode, Travelling mode, etc.) and set a condition on your automations to run only when that helper is off. With this you can manually bypass your automations,

I have many automations that based on events. This is how I did it:

calender.json

{
  "json_calendars": {
    "events": {
      "11/23":"Black Friday",
      "11/24":"Black Friday",
      "11/25":"Black Friday",
      "11/26":"Black Friday",
      "11/27":"Black Friday",
      "12/31":"New Year's Eve"
    },
    "holiday": {
      "1/1":"Christmas",
      "1/2":"Christmas",
      "1/3":"Christmas",
      "2/14":"Valentine's Day",
      "4/1":"April Fool's Day",
      "4/27":"Kingsday",
      "5/11":"Birthday",
      "5/14":"Eurovision",
      "7/4":"Independence Day",
      "8/19":"Birthday",
      "9/2":"Special Day P&K",
      "10/1":"Halloween",
      "10/2":"Halloween",
      "10/3":"Halloween",
      "10/4":"Halloween",
      "10/5":"Halloween",
      "10/6":"Halloween",
      "10/7":"Halloween",
      "10/8":"Halloween",
      "10/9":"Halloween",
      "10/10":"Halloween",
      "10/11":"Halloween",
      "10/12":"Halloween",
      "10/13":"Halloween",
      "10/14":"Halloween",
      "10/15":"Halloween",
      "10/16":"Halloween",
      "10/17":"Halloween",
      "10/18":"Halloween",
      "10/19":"Halloween",
      "10/20":"Halloween",
      "10/21":"Halloween",
      "10/22":"Halloween",
      "10/23":"Halloween",
      "10/24":"Halloween",
      "10/25":"Halloween",
      "10/26":"Halloween",
      "10/27":"Halloween",
      "10/28":"Halloween",
      "10/29":"Halloween",
      "10/30":"Halloween",
      "10/31":"Halloween",
      "11/15":"Christmas",
      "11/16":"Christmas",
      "11/17":"Christmas",
      "11/18":"Christmas",
      "11/19":"Christmas",
      "11/20":"Christmas",
      "11/21":"Christmas",
      "11/22":"Christmas",
      "11/23":"Christmas",
      "11/24":"Christmas",
      "11/25":"Christmas",
      "11/26":"Christmas",
      "11/27":"Christmas",
      "11/28":"Christmas",
      "11/29":"Christmas",
      "11/30":"Christmas",
      "12/1":"Christmas",
      "12/2":"Christmas",
      "12/3":"Christmas",
      "12/4":"Christmas",
      "12/5":"Christmas",
      "12/6":"Christmas",
      "12/7":"Christmas",
      "12/8":"Christmas",
      "12/9":"Christmas",
      "12/10":"Christmas",
      "12/11":"Christmas",
      "12/12":"Christmas",
      "12/13":"Christmas",
      "12/14":"Christmas",
      "12/15":"Christmas",
      "12/16":"Christmas",
      "12/17":"Christmas",
      "12/18":"Christmas",
      "12/19":"Christmas",
      "12/20":"Christmas",
      "12/21":"Christmas",
      "12/22":"Christmas",
      "12/23":"Christmas",
      "12/24":"Christmas",
      "12/25":"Christmas",
      "12/26":"Christmas",
      "12/27":"Christmas",
      "12/28":"Christmas",
      "12/29":"Christmas",
      "12/30":"Christmas",
      "12/31":"Christmas"
    }
  }
}

2 Sensors:

- platform: command_line
  unique_id: "490f80c3-7bde-47c0-a6fa-c2ed6d742926"
  name: "Holiday"
  command: "cat /config/package/json/calendar.json"
  scan_interval: 21600
  value_template: >-
    {% set today = now().month  ~ '/' ~ now().day  %}
    {% set holiday =  value_json.json_calendars.holiday[ today ] %}
      {% if holiday | trim == "" %}
        {% set holiday =  "Nothing" %}
        {% endif %}
    {{ holiday }}

- platform: command_line
  unique_id: "716b7f41-ac6d-4df2-b01a-31b2ccf9e138"
  name: "Events"
  command: "cat /config/package/json/calendar.json"
  scan_interval: 21600
  value_template: >-
    {% set today = now().month  ~ '/' ~ now().day  %}
    {% set events =  value_json.json_calendars.events[ today ] %}
      {% if events | trim == "" %}
        {% set events =  "Nothing" %}
        {% endif %}
    {{ events }}

When there is nothing in the calendar.json then state is ‘Nothing’
Possible condition: When the state is true then proceed, when false then skip

- id: "c54afbee-cd69-4cf3-8a55-4cbc2979234f"
  alias: "Scene - AppleTV"
  mode: restart
  trigger:
    - platform: time_pattern
      minutes: "/1"

    - platform: state
      entity_id: sensor.harmony
      to: "AppleTV"

  condition:
    - "{{ is_state('sensor.holiday', 'Nothing') }}"

  action:
    ...

A automation based on those sensors:

    - service: light.turn_on
      target:
        entity_id: light.nanoleaf
      data:
        brightness_pct: 20
        effect: >-
          {% if is_state('sensor.holiday', 'Christmas') %} 
            Christmas
          {% elif is_state('sensor.holiday', 'Halloween') %} 
            Halloween
          {% elif is_state('sensor.holiday', 'Eurovision') %} 
            Kay
          {% elif states('sensor.holiday') in ['Kingsday', 'Birthday'] %} 
            Kingsday
          {% else %} 
            Kay
          {% endif %}

With this setup I only need to update the calendar.json file with other dates and then use them.

1 Like

This was the approach I was wanting, but spent several hours last night trying to get google calendar to work, but when I got to the part of adding the keycode from HA into google, google would say success, but HA would just time out.

I don’t use Google. I have some automations based on my apple.calendar. Maybe I create a calendar with above dates so I can remove the json file. But I don’t see the benefits of switching :sunglasses:

1 Like