This is a good solution but sometimes the kids don’t have school and I still work or vise versa. I’ll have to look into this for a normal pattern. Thanks for the information!
As I work early and late shifts I am using a google Calendar, it doesn’t take too long to setup as you can repeats things in the calendar. This then triggers different input_booleans depending on what shift I work and if it’s a weekend or I am hosting a dinner part etc.
- id: work_alarm_on
alias: Work Alarm On (school)
trigger:
- platform: state
entity_id: input_boolean.corey_work_alarm_school
from: 'off'
to: 'on'
action:
- service: homeassistant.turn_on
entity_id: automation.corey_work_alarm_school
- id: work_alarm_off
alias: Work Alarm (school)
trigger:
- platform: state
entity_id: input_boolean.corey_work_alarm_school
from: 'on'
to: 'off'
action:
- service: homeassistant.turn_off
entity_id: automation.corey_work_alarm_school
- id: boys_alarm_on
alias: Boys Alarm On School
trigger:
- platform: state
entity_id: input_boolean.boys_school_alarm
from: 'off'
to: 'on'
action:
- service: homeassistantn.turn_on
entity_id: automation.boys_school_wakeup
- id: boys_alarm_off
alias: Boys Alarm Off School
trigger:
- platform: state
entity_id: input_boolean.boys_school_alarm
from: 'on'
to: 'off'
action:
- service: homeassistant.turn_off
entity_id: automation.boys_school_wakeup
- id: courtney_alarm_on
alias: Courtney's Alarm On School
trigger:
- platform: state
entity_id: input_boolean.courtney_school_alarm
from: 'off'
to: 'on'
action:
- service: homeassistant.turn_on
entity_id: automation.courtney_school_alarm
- id: courtney_alarm_off
alias: Courtney's Alarm Off School
trigger:
- platform: state
entity_id: input_boolean.courtney_school_alarm
from: 'on'
to: 'off'
action:
- service: homeassistant.turn_off
entity_id: automation.courtney_school_alarm
input_booleans:
boys_school_alarm:
name: Boys School Alarm
courtney_school_alarm:
name: Courtney's School Alarm
corey_work_alarm_school:
name: Corey's Work Alarm (School)
corey_work_alarm_no_school:
name: Work Alarm (no school)
If anybody could tell me what Im doing wrong I would be grateful, I have been trying to do this for a few hours now, and I think I may just be missing something obvious. But I keep getting errors and can’t figure out why.
Thanks!
Corey
Remove your input booleans and there automations. Use the following switch templates (I also noticed your personal automation has differing names, I fixed that in the switch templates and made a note for you).
switch:
- platform: template
switches:
# switch to turn on automation for corey
work_alarm:
value_template: "{{ is_state('automation.work_alarm','on') }}" #You had wrong entity_id above
turn_on:
- service: homeassistant.turn_on
entity_id: automation.work_alarm
turn_of:
- service: homeassistant.turn_off
entity_id: automation.work_alarm
# switch to turn on automation for boys
boys_school_wakeup:
value_template: "{{ is_state('automation.boys_school_wakeup','on') }}"
turn_on:
- service: homeassistant.turn_on
entity_id: automation.boys_school_wakeup
turn_of:
- service: homeassistant.turn_off
entity_id: automation.boys_school_wakeup
# switch to turn on automation for courtney
courtney_school_alarm:
value_template: "{{ is_state('automation.courtney_school_alarm','on') }}"
turn_on:
- service: homeassistant.turn_on
entity_id: automation.courtney_school_alarm
turn_of:
- service: homeassistant.turn_off
entity_id: automation.courtney_school_alarm
Does this still give me the ability to turn on and off each night for changing conditions?
I finally did get it working this morning. I did split up my boys automations so if one of them doesn’t have to go to school at the normal time.
- id: cameron_school_wakeup
trigger:
- platform: time
at: '06:35:00'
action:
- service: script.turn_on
entity_id: script.cameron_time_for_school
- service: homeassistant.turn_on
entity_id: group.hue_cameron_school
- service: notify.notify
data_template:
message: >
Wake up Cameron its time to get up for school Automation Started {{ "\ud83d\udca9" }}
- delay: '00:01:00'
- service: script.turn_on
entity_id: script.cameron_time_for_school
- delay: '00:32:00'
- service: script.turn_on
entity_id: script.cameron_leave_for_school
- delay: '00:01:00'
- service: script.turn_on
data:
entity_id: script.cameron_leave_for_school
- delay: '00:01:00'
- service: homeassistant.turn_off
entity_id: group.hue_cameron_school
- id: morgan_school_wakeup
trigger:
- platform: time
at: '06:40:00'
action:
- service: script.turn_on
entity_id: script.morgan_time_for_school
- service: homeassistant.turn_on
entity_id: group.hue_morgan_school
- service: notify.notify
data_template:
message: >
Wake up Morgan its time to get up for school Automation Started {{ "\ud83d\udca9" }}
- delay: '00:01:00'
- service: script.turn_on
entity_id: script.morgan_time_for_school
- delay: '00:28:00'
- service: script.turn_on
entity_id: script.morgan_leave_for_school
- delay: '00:01:00'
- service: script.turn_on
data:
entity_id: script.morgan_leave_for_school
- delay: '00:01:00'
- service: homeassistant.turn_off
entity_id: group.hue_morgan_school
I did offset them a few minutes because I wasn’t sure if I could send them at the same time (I use alexa TTS to send messages to their amazon dots)
Im more then happy to use templates and it definitely looks better assuming I can still turn it on and off preferably in HomeKit.
Thanks for your help on this, Im sure I can figure out how to rewrite my boys automations based on your example. You sir are truly amazing and I really appreciate it!
It depends on what you are using. HomeKIt has that ability, but other components might not. I made a template switch for a few automations because the on/off functionality acted weird when they were run through alexa with emulated hue. It’s all just personal preference.