[ { "id": "Office Light Weekday Schedule", "automation": "- alias: Office Light Weekday Schedule\n description: Turn on office light at 9am if home; turn off at 5pm if on.\n triggers:\n - at: 09:00:00\n platform: time\n - at: '17:00:00'\n platform: time\n conditions: []\n actions:\n - choose:\n - conditions:\n - condition: time\n weekday:\n - mon\n - tue\n - wed\n - thu\n - fri\n - condition: template\n value_template: '{{ now().hour == 9 and now().minute == 0 }}'\n - condition: state\n entity_id: person.jason\n state: home\n sequence:\n - service: switch.turn_on\n target:\n entity_id: switch.office_light\n - conditions:\n - condition: time\n weekday:\n - mon\n - tue\n - wed\n - thu\n - fri\n - condition: template\n value_template: '{{ now().hour == 17 and now().minute == 0 }}'\n - condition: state\n entity_id: switch.office_light\n state: 'on'\n sequence:\n - service: switch.turn_off\n target:\n entity_id: switch.office_light\n mode: single", "config": [ { "name": "Jason", "room": null, "type": "person", "id": { "entity_id": "person.jason", "device_id": null } }, { "name": "office light", "room": "office", "type": "switch", "id": { "entity_id": "switch.office_light", "device_id": null } } ] }, { "id": "Patriotic Holiday Lights (Auto)", "automation": "- alias: Patriotic Holiday Lights (Auto)\n description: Sets red, white, and blue lights for Memorial Day, July 4th (July 1–5),\n Labor Day, and Veterans Day\n triggers:\n - platform: sun\n event: sunset\n offset: +00:15:00\n - platform: state\n entity_id:\n - light.coach_light_1\n - light.coach_light_2\n - light.coach_light_3\n from:\n - 'off'\n - unavailable\n to: 'on'\n conditions: []\n actions:\n - choose:\n - conditions:\n - condition: template\n value_template: '{{ should_set_colors }}'\n sequence:\n - target:\n entity_id: light.coach_light_1\n data:\n rgb_color:\n - 255\n - 0\n - 0\n action: light.turn_on\n - target:\n entity_id: light.coach_light_2\n data:\n rgb_color:\n - 255\n - 255\n - 255\n action: light.turn_on\n - target:\n entity_id: light.coach_light_3\n data:\n rgb_color:\n - 0\n - 0\n - 255\n action: light.turn_on\n - conditions:\n - condition: template\n value_template: '{{ should_reset }}'\n sequence:\n - target:\n entity_id:\n - light.coach_light_1\n - light.coach_light_2\n - light.coach_light_3\n data:\n color_temp: 300\n action: light.turn_on\n variables:\n today: '{{ now().date() }}'\n year: '{{ now().year }}'\n july_start: '{{ strptime(year ~ ''-07-01'', ''%Y-%m-%d'').date() }}'\n july_end: '{{ strptime(year ~ ''-07-05'', ''%Y-%m-%d'').date() }}'\n veterans_day: '{{ strptime(year ~ ''-11-11'', ''%Y-%m-%d'').date() }}'\n memorial_day: \"{% set last_day = namespace(date=none) %} {% for day in range(25,\\\n \\ 32) %}\\n {% set dt = strptime(year ~ '-05-' ~ day|string, '%Y-%m-%d') %}\\n\\\n \\ {% if dt.weekday() == 0 %}\\n {% set last_day.date = dt.date() %}\\n {%\\\n \\ endif %}\\n{% endfor %} {{ last_day.date }}\\n\"\n labor_day: \"{% for day in range(1, 8) %}\\n {% set dt = strptime(year ~ '-09-'\\\n \\ ~ day|string, '%Y-%m-%d') %}\\n {% if dt.weekday() == 0 %}\\n {{ dt.date()\\\n \\ }}\\n {% endif %}\\n{% endfor %}\\n\"\n should_set_colors: \"{{ today >= july_start and today <= july_end\\n or today\\\n \\ == memorial_day\\n or today == labor_day\\n or today == veterans_day }}\\n\"\n should_reset: \"{{ today == july_end + timedelta(days=1)\\n or today == memorial_day\\\n \\ + timedelta(days=1)\\n or today == labor_day + timedelta(days=1)\\n or today\\\n \\ == veterans_day + timedelta(days=1) }}\\n\"\n mode: single", "config": [ { "name": "coach light 1", "room": null, "type": "light", "id": { "entity_id": "light.coach_light_1", "device_id": null } }, { "name": "coach light 2", "room": null, "type": "light", "id": { "entity_id": "light.coach_light_2", "device_id": null } }, { "name": "coach light 3", "room": null, "type": "light", "id": { "entity_id": "light.coach_light_3", "device_id": null } } ] } ]