AutomationDataset/duceduc/duceduc_automations.yaml

5122 lines
159 KiB
YAML

- alias: LR Aircon
triggers:
- trigger: template
value_template: '{{ (now() - states.binary_sensor.lr_ac_flaps_contact.last_changed).seconds
< 4 }}'
id: flaps
- trigger: state
entity_id: input_select.lr_ac_mode
id: mode
actions:
- choose:
- conditions:
- condition: trigger
id: mode
sequence:
- action: '{% if is_state(''input_select.lr_ac_mode'', ''Powerful Heat'') %}
script.lr_ac_powerful_heat
{% elif is_state(''input_select.lr_ac_mode'', ''Normal Heat'') %} script.lr_ac_normal_heat
{% elif is_state(''input_select.lr_ac_mode'', ''Silent Heat'') %} script.lr_ac_silent_heat
{% elif is_state(''input_select.lr_ac_mode'', ''Manual Heat'') %} script.lr_heat_man
{% elif is_state(''input_select.lr_ac_mode'', ''Powerful Cool'') %} script.lr_ac_powerful_cool
{% elif is_state(''input_select.lr_ac_mode'', ''Normal Cool'') %} script.lr_ac_normal_cool
{% elif is_state(''input_select.lr_ac_mode'', ''Silent Cool'') %} script.lr_ac_silent_cool
{% elif is_state(''input_select.lr_ac_mode'', ''Manual Cool'') %} script.lr_cool_man
{% elif is_state(''input_select.lr_ac_mode'', ''Normal Humidifier'') %}
script.lr_ac_normal_humidifier
{% elif is_state(''input_select.lr_ac_mode'', ''Ai Auto'') %} script.lr_ac_ai
{% elif is_state(''input_select.lr_ac_mode'', ''Man Auto'') %} script.lr_man_auto
{% elif is_state(''input_select.lr_ac_mode'', ''Fan'') %} script.lr_ac_fan
{% elif is_state(''input_select.lr_ac_mode'', ''Off'') %} script.lr_ac_off
{% endif %}
'
- conditions:
- condition: trigger
id: flaps
sequence:
- condition: template
value_template: '{{ not states(''binary_sensor.lr_ac_flaps_contact'').lower()
in [''unknown'',''unavailable'',''none''] }}'
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: "{% if (now() - states.input_select.lr_ac_mode.last_changed).seconds\
\ < 10 %}\n {{ states('input_select.lr_ac_mode') }}\n{% elif is_state('binary_sensor.lr_ac_flaps_contact',\
\ 'off') %} Off\n{% elif is_state('binary_sensor.lr_ac_flaps_contact',\
\ 'on') %} Man Auto\n{% else %}\n{% endif %}\n"
default: []
- alias: LR Aircon AM Schedule
triggers:
- trigger: state
entity_id:
- binary_sensor.lr_ac_am_automation_time_active
- binary_sensor.lr_ac_heat_required
- binary_sensor.lr_ac_cool_required
to: 'on'
for: 10
- trigger: state
entity_id: binary_sensor.hallway_door
to: 'off'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.vacation_mode'', ''on'') }}'
- condition: state
entity_id: input_select.lr_ac_mode
state: 'Off'
- condition: state
entity_id: binary_sensor.hallway_door
state: 'off'
- condition: state
entity_id: binary_sensor.lr_radar_status
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.lr_ac_heat_required
state: 'on'
- condition: state
entity_id: binary_sensor.lr_ac_cool_required
state: 'on'
- condition: state
entity_id: binary_sensor.lr_ac_am_automation_time_active
state: 'on'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: "{% if is_state('binary_sensor.lr_ac_heat_required', 'on') %}\n Normal\
\ Heat\n{% elif is_state('binary_sensor.lr_ac_cool_required', 'on') %}\n \
\ Normal Cool\n{% else %}\n 'Off'\n{% endif %}\n"
- alias: LR Aircon PM Schedule
triggers:
- trigger: state
entity_id:
- binary_sensor.lr_ac_pm_automation_time_active
- binary_sensor.lr_ac_heat_required
- binary_sensor.lr_ac_cool_required
to: 'on'
for: 10
- trigger: state
entity_id: binary_sensor.hallway_door
to: 'off'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.vacation_mode'', ''on'') }}'
- condition: state
entity_id: input_select.lr_ac_mode
state: 'Off'
- condition: state
entity_id: binary_sensor.hallway_door
state: 'off'
- condition: state
entity_id: binary_sensor.lr_radar_status
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.lr_ac_heat_required
state: 'on'
- condition: state
entity_id: binary_sensor.lr_ac_cool_required
state: 'on'
- condition: state
entity_id: binary_sensor.lr_ac_pm_automation_time_active
state: 'on'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: "{% if is_state('binary_sensor.lr_ac_heat_required', 'on') %}\n Normal\
\ Heat\n{% elif is_state('binary_sensor.lr_ac_cool_required', 'on') %}\n \
\ Normal Cool\n{% else %}\n 'Off'\n{% endif %}\n"
- alias: LR Aircon AM Off
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.lr_ac_am_automation_time_active
to: 'off'
conditions:
- condition: state
entity_id: automation.lr_aircon_am_schedule
state: 'on'
- condition: template
value_template: '{{ states("input_select.lr_ac_mode") != "Off" }}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ is_state(''binary_sensor.living_airfreshener_presence'', ''off'')
}}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: 'Off'
- alias: LR Aircon PM Off
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.lr_ac_pm_automation_time_active
to: 'off'
conditions:
- condition: state
entity_id: automation.lr_aircon_pm_schedule
state: 'on'
- condition: template
value_template: '{{ states("input_select.lr_ac_mode") != "Off" }}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ is_state(''binary_sensor.living_airfreshener_presence'', ''off'')
}}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: 'Off'
- alias: LR Room Aircon Cool Temperature Adjust
initial_state: true
triggers:
- trigger: state
entity_id: input_number.lr_ac_temp_set_cool
conditions:
- condition: template
value_template: '{{ ''Cool'' in states.input_select.lr_ac_mode.state }}'
actions:
- action: '{% if states(''input_number.lr_ac_temp_set_cool'')| int != 0 %} script.lr_cool_man
{% endif %}
'
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: Manual Cool
- alias: LR Room Aircon Heat Temperature Adjust
initial_state: true
triggers:
- trigger: state
entity_id: input_number.lr_ac_temp_set_heat
conditions:
- condition: template
value_template: '{{ ''Heat'' in states.input_select.lr_ac_mode.state }}'
actions:
- action: '{% if states(''input_number.lr_ac_temp_set_heat'')| int != 0 %} script.lr_heat_man
{% endif %}
'
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: Manual Heat
- alias: LR Room Aircon Humidity Set
initial_state: true
triggers:
- trigger: state
entity_id: input_number.lr_humidity_set
conditions:
- condition: template
value_template: '{{ ''Cool'' in states.input_select.lr_ac_mode.state }}'
actions:
- action: '{% if states(''input_number.lr_humidity_set'')| int != 0 %} script.lr_humidity_set
{% endif %}
'
- alias: LR Powerful Cool On
initial_state: true
triggers:
- trigger: state
entity_id: input_select.lr_ac_mode
to: Normal Cool
for:
minutes: 30
- trigger: state
entity_id: binary_sensor.lr_ac_cool_required
to: 'on'
for:
minutes: 5
conditions:
- condition: state
entity_id: binary_sensor.lr_ac_cool_required
state: 'on'
- condition: state
entity_id: input_select.lr_ac_mode
state: Normal Cool
actions:
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: Powerful Cool
- alias: LR Powerful Cool Off
initial_state: true
triggers:
- trigger: state
entity_id: input_select.lr_ac_mode
to: Powerful Cool
for:
minutes: 30
- trigger: state
entity_id: binary_sensor.lr_ac_cool_required
to: 'off'
for:
minutes: 5
conditions:
- condition: state
entity_id: input_select.lr_ac_mode
state: Powerful Cool
actions:
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: Normal Cool
- alias: LR Powerful Heat Off
initial_state: true
triggers:
- trigger: state
entity_id: input_select.lr_ac_mode
to: Powerful Heat
for: 00:30:00
- trigger: state
entity_id: binary_sensor.lr_ac_heat_required
to: 'off'
for: 00:05:00
conditions:
- condition: state
entity_id: input_select.lr_ac_mode
state: Powerful Heat
actions:
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: Normal Heat
- alias: LR Powerful Heat On
initial_state: true
triggers:
- trigger: state
entity_id: input_select.lr_ac_mode
to: Normal Heat
for: 00:30:00
- trigger: state
entity_id: binary_sensor.lr_ac_heat_required
to: 'on'
for: 00:05:00
conditions:
- condition: state
entity_id: binary_sensor.lr_ac_heat_required
state: 'on'
- condition: state
entity_id: input_select.lr_ac_mode
state: Normal Heat
actions:
- action: input_select.select_option
data:
entity_id: input_select.lr_ac_mode
option: Powerful Heat
- alias: LR Heating Seasonal Adjustment AM
initial_state: true
triggers:
- trigger: time
at: 04:00:00
actions:
- action: input_number.set_value
data:
entity_id: input_number.lr_heater_heat_temp_set
value: "{% if is_state('sensor.season', 'summer') %}\n 18\n{% elif is_state('sensor.season',\
\ 'autumn') %}\n 19\n{% elif is_state('sensor.season', 'winter') %}\n 17\n\
{% elif is_state('sensor.season', 'spring') %}\n 17\n{% endif %}\n"
- condition: template
value_template: '{{ states(''sensor.entrance_temperature'')|float(0) > 22 }}'
- action: input_number.set_value
data:
entity_id: input_number.lr_heater_heat_temp_set
value: 16
- alias: LR Heating Seasonal Adjustment PM
initial_state: true
triggers:
- trigger: time
at: '13:00:00'
actions:
- action: input_number.set_value
data:
entity_id: input_number.lr_heater_heat_temp_set
value: "{% if is_state('sensor.season', 'summer') %}\n 18\n{% elif is_state('sensor.season',\
\ 'autumn') %}\n 19\n{% elif is_state('sensor.season', 'winter') %}\n 18\n\
{% elif is_state('sensor.season', 'spring') %}\n 17\n{% endif %}\n"
- alias: SB Humidifier
initial_state: true
triggers:
- trigger: state
entity_id: input_select.sb_humidifier_mode
actions:
- action: '{% if is_state(''input_select.sb_humidifier_mode'', ''Low'') %} script.humidifier_low
{% elif is_state(''input_select.sb_humidifier_mode'', ''Med'') %} script.humidifier_med
{% elif is_state(''input_select.sb_humidifier_mode'', ''High'') %} script.humidifier_high
{% elif is_state(''input_select.sb_humidifier_mode'', ''Auto'') %} script.humidifier_auto
{% elif is_state(''input_select.sb_humidifier_mode'', ''Off'') %} script.humidifier_off
{% endif %}
'
- alias: SB Humidifier Intensity
initial_state: true
triggers:
- trigger: state
entity_id: input_number.lrh_humidity_intensity_set
conditions:
- condition: template
value_template: '{{ is_state(''input_boolean.sb_humidifier'', ''on'') }}'
actions:
- action: script.lrh_humidity_intensity_set
- alias: SB Humidifier AM Schedule
triggers:
- trigger: state
entity_id: binary_sensor.lrh_humidifier_am_automation_time_active
to: 'on'
for: 10
condition:
- condition: template
value_template: '{{ is_state(''input_boolean.lrh_humidifier_automation_enable'',
''on'') }}'
- condition: template
value_template: '{{ is_state(''input_select.sb_humidifier_mode'', ''Off'') }}'
- condition: numeric_state
entity_id: sensor.lr_radar_humidity
above: input_number.lrh_humidity_low_set
below: input_number.lrh_humidity_high_set
- condition: template
value_template: '{{ is_state(''sensor.sb_humidifier_lack_water'', ''False'') }}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.sb_humidifier_mode
option: High
- alias: SB Humidifier PM Schedule
triggers:
- trigger: state
entity_id: binary_sensor.lrh_humidifier_pm_automation_time_active
to: 'on'
for: 10
conditions:
- condition: template
value_template: '{{ is_state(''input_boolean.lrh_humidifier_automation_enable'',
''on'') }}'
- condition: template
value_template: '{{ is_state(''input_select.sb_humidifier_mode'', ''Off'') }}'
- condition: numeric_state
entity_id: sensor.sb_humidifier_humidity
above: input_number.lrh_humidity_low_set
below: input_number.lrh_humidity_high_set
- condition: template
value_template: '{{ is_state(''sensor.sb_humidifier_lack_water'', ''False'') }}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.sb_humidifier_mode
option: High
- alias: SB Humidifier AM Off
triggers:
- trigger: state
entity_id: binary_sensor.lrh_humidifier_am_automation_time_active
to: 'off'
conditions:
- condition: state
entity_id: automation.sb_humidifier_am_schedule
state: 'on'
- condition: template
value_template: '{{ states("input_select.sb_humidifier_mode") != "Off" }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.sb_humidifier_mode
option: 'Off'
- alias: SB Humidifier PM Off
triggers:
- trigger: state
entity_id: binary_sensor.lrh_humidifier_pm_automation_time_active
to: 'off'
conditions:
- condition: state
entity_id: automation.sb_humidifier_pm_schedule
state: 'on'
- condition: template
value_template: '{{ states("input_select.sb_humidifier_mode") != "Off" }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.sb_humidifier_mode
option: 'Off'
- alias: Masterroom Occupancy
description: Defines occupancy state for room
mode: single
triggers:
- trigger: time_pattern
id: time
seconds: '10'
- trigger: state
entity_id: binary_sensor.mr_human_sensor_moving_target
id: motion
to: 'on'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
- condition: time
after: 06:00:00
before: '22:01:00'
actions:
- action: python_script.room_occupancy
data:
roomname: masterroom
timeout: 2
entities_toggle:
- binary_sensor.mr_human_sensor_moving_target
entities_keep:
- binary_sensor.mr_presence
- input_boolean.masterroom_mcl
- alias: Masterroom Light
description: toggle light depending on timer state
mode: single
triggers:
- trigger: state
entity_id: timer.masterroom_timer
id: 'on'
from: idle
to: active
- trigger: state
entity_id: timer.masterroom_timer
id: 'off'
from: active
to: idle
- trigger: state
entity_id: light.master
id: 'off'
from: 'on'
to: 'off'
- trigger: state
entity_id: binary_sensor.mr_occupancy_lights
id: 'off'
from: 'on'
to: 'off'
for: 45
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ not is_state(''binary_sensor.desktop_status'', ''off'') }}'
- condition: time
after: 06:00:00
before: '22:01:00'
actions:
- choose:
- conditions:
- condition: trigger
id: 'on'
sequence:
- action: script.tradfri_transition
data:
entity_id: light.m_1
color_temp: 370
transition: 2
brightness: 255
entity_id: light.m_1
- conditions:
- condition: trigger
id: 'off'
- condition: template
value_template: '{{ not is_state(''input_boolean.masterroom_mcl'', ''on'')
}}'
sequence:
- action: light.turn_off
target:
entity_id: light.master
- action: timer.finish
target:
entity_id: timer.masterroom_timer
default: []
- alias: Masterroom Auto-on
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.masterroom_occupied
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ not is_state(''binary_sensor.desktop_status'', ''off'') }}'
- condition: time
after: 06:00:00
before: '22:01:00'
actions:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.masterroom_occupied
state: 'on'
sequence:
- action: script.tradfri_transition
data:
entity_id: light.m_1
color_temp: 370
transition: 2
brightness: 255
default:
- action: light.turn_off
target:
entity_id: light.master
- alias: MR light turned off
triggers:
- trigger: state
entity_id: light.master
from: 'on'
to: 'off'
actions:
- action: timer.start
entity_id: timer.mr_mcl
- alias: MR light turned on
triggers:
- trigger: state
entity_id: light.master
from: 'off'
to: 'on'
conditions:
- condition: template
value_template: '{{ is_state(''timer.mr_mcl'', ''active'') }}'
actions:
- action: input_boolean.toggle
entity_id: input_boolean.masterroom_mcl
- alias: MR MCL Announce State
triggers:
- trigger: state
entity_id: input_boolean.masterroom_mcl
conditions:
- condition: template
value_template: '{{ is_state(''input_boolean.audible_notifications'', ''on'')
}}'
actions:
- action: script.speech_engine
data:
who: ai_2
message: include ../tpl/speech/control_status.yaml
voice: '{{ states(''input_select.jarvis_voice'') }}'
- alias: MR MCL Re-Enable
triggers:
- trigger: state
entity_id: input_boolean.masterroom_mcl
to: 'on'
for: 01:00:00
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.masterroom_mcl
- alias: MR Aircon
initial_state: true
triggers:
- trigger: state
entity_id: input_select.mr_ac_mode
actions:
- action: '{% if is_state(''input_select.mr_ac_mode'', ''Powerful Heat'') %} script.mr_ac_powerful_heat
{% elif is_state(''input_select.mr_ac_mode'', ''Normal Heat'') %} script.mr_ac_normal_heat
{% elif is_state(''input_select.mr_ac_mode'', ''Silent Heat'') %} script.mr_ac_silent_heat
{% elif is_state(''input_select.mr_ac_mode'', ''Manual Heat'') %} script.mr_heat_man
{% elif is_state(''input_select.mr_ac_mode'', ''Powerful Cool'') %} script.mr_ac_powerful_cool
{% elif is_state(''input_select.mr_ac_mode'', ''Normal Cool'') %} script.mr_ac_normal_cool
{% elif is_state(''input_select.mr_ac_mode'', ''Silent Cool'') %} script.mr_ac_silent_cool
{% elif is_state(''input_select.mr_ac_mode'', ''Manual Cool'') %} script.mr_cool_man
{% elif is_state(''input_select.mr_ac_mode'', ''Normal Humidifier'') %} script.mr_ac_normal_humidifier
{% elif is_state(''input_select.mr_ac_mode'', ''Ai Auto'') %} script.mr_ac_ai
{% elif is_state(''input_select.mr_ac_mode'', ''Man Auto'') %} script.mr_man_auto
{% elif is_state(''input_select.lr_ac_mode'', ''Fan'') %} script.mr_ac_fan {%
elif is_state(''input_select.mr_ac_mode'', ''Off'') %} script.mr_ac_off {% endif
%}
'
- alias: MR Aircon AM Schedule
triggers:
- trigger: state
entity_id:
- binary_sensor.mr_ac_am_automation_time_active
- binary_sensor.mr_ac_heat_required
- binary_sensor.mr_ac_cool_required
to: 'on'
for: 10
- trigger: state
entity_id: binary_sensor.master_door
to: 'off'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.vacation_mode'', ''on'') }}'
- condition: state
entity_id: input_select.mr_ac_mode
state: 'Off'
- condition: state
entity_id: binary_sensor.master_door
state: 'off'
- condition: state
entity_id: binary_sensor.mr_dht_sensor_status
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.mr_ac_heat_required
state: 'on'
- condition: state
entity_id: binary_sensor.mr_ac_cool_required
state: 'on'
- condition: state
entity_id: binary_sensor.mr_ac_am_automation_time_active
state: 'on'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.mr_ac_mode
option: "{% if is_state('binary_sensor.mr_ac_heat_required', 'on') %}\n Normal\
\ Heat\n{% elif is_state('binary_sensor.mr_ac_cool_required', 'on') %}\n \
\ Normal Cool\n{% else %}\n 'Off'\n{% endif %}\n"
- alias: MR Aircon PM Schedule
triggers:
- trigger: state
entity_id:
- binary_sensor.mr_ac_pm_automation_time_active
- binary_sensor.mr_ac_heat_required
- binary_sensor.mr_ac_cool_required
to: 'on'
for: 10
- trigger: state
entity_id: binary_sensor.master_door
to: 'off'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.vacation_mode'', ''on'') }}'
- condition: state
entity_id: input_select.mr_ac_mode
state: 'Off'
- condition: state
entity_id: binary_sensor.master_door
state: 'off'
- condition: state
entity_id: binary_sensor.mr_dht_sensor_status
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.mr_ac_heat_required
state: 'on'
- condition: state
entity_id: binary_sensor.mr_ac_cool_required
state: 'on'
- condition: state
entity_id: binary_sensor.mr_ac_pm_automation_time_active
state: 'on'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.mr_ac_mode
option: "{% if is_state('binary_sensor.mr_ac_heat_required', 'on') %}\n Normal\
\ Heat\n{% elif is_state('binary_sensor.mr_ac_cool_required', 'on') %}\n \
\ Normal Cool\n{% else %}\n 'Off'\n{% endif %}\n"
- alias: MR Aircon AM Off
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.mr_ac_am_automation_time_active
to: 'off'
conditions:
- condition: state
entity_id: automation.mr_aircon_am_schedule
state: 'on'
- condition: template
value_template: '{{ states("input_select.mr_ac_mode") = "Off" }}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.mr_ac_mode
option: 'Off'
- alias: MR Aircon PM Off
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.mr_ac_pm_automation_time_active
to: 'off'
conditions:
- condition: state
entity_id: automation.mr_aircon_pm_schedule
state: 'on'
- condition: template
value_template: '{{ states("input_select.mr_ac_mode") = "Off" }}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.mr_ac_mode
option: 'Off'
- alias: MR Aircon Cool Temperature Adjust
initial_state: true
triggers:
- trigger: state
entity_id: input_number.mr_ac_temp_set_cool
conditions:
- condition: template
value_template: '{{ ''Cool'' in states.input_select.mr_ac_mode.state }}'
actions:
- action: '{% if states(''input_number.mr_ac_temp_set_cool'')| int = 0 %} script.mr_cool_man
{% endif %}
'
- action: input_select.select_option
data:
entity_id: input_select.mr_ac_mode
option: Manual Cool
- alias: MR Aircon Heat Temperature Adjust
initial_state: true
triggers:
- trigger: state
entity_id: input_number.mr_ac_temp_set_heat
conditions:
- condition: template
value_template: '{{ ''Heat'' in states.input_select.mr_ac_mode.state }}'
actions:
- action: '{% if states(''input_number.mr_ac_temp_set_heat'')| int = 0 %} script.mr_heat_man
{% endif %}
'
- action: input_select.select_option
data:
entity_id: input_select.mr_ac_mode
option: Manual Heat
- alias: MR Room Aircon Humidity Set
initial_state: true
triggers:
- trigger: state
entity_id: input_number.mr_humidity_set
conditions:
- condition: template
value_template: '{{ ''Cool'' in states.input_select.mr_ac_mode.state }}'
actions:
- action: '{% if states(''input_number.mr_humidity_set'')| int = 0 %} script.mr_humidity_set
{% endif %}
'
- alias: Shionroom Occupancy
description: Defines occupancy state for room
mode: single
triggers:
- trigger: time_pattern
id: time
seconds: '10'
- trigger: state
entity_id: binary_sensor.sr_moving_target
id: motion
to: 'on'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
actions:
- action: python_script.room_occupancy
data:
roomname: shionroom
timeout: 2
entities_toggle:
- binary_sensor.sr_moving_target
entities_keep:
- binary_sensor.sr_presence
- binary_sensor.sr_has_target
- group.bed_sensors
- input_boolean.shionroom_mcl
- binary_sensor.sr_study_occupancy
- alias: Shionroom Light
description: toggle light depending on timer state
mode: single
triggers:
- trigger: state
entity_id: timer.shionroom_timer
id: 'on'
from: idle
to: active
- trigger: state
entity_id: timer.shionroom_timer
id: 'off'
from: active
to: idle
- trigger: state
entity_id: light.shion
id: 'off'
from: 'on'
to: 'off'
- trigger: state
entity_id: binary_sensor.sr_occupancy_lights
id: 'off'
from: 'on'
to: 'off'
for: 45
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ is_state(''binary_sensor.motion_sr_auto_on'', ''on'') }}'
actions:
- choose:
- conditions:
- condition: trigger
id: 'on'
sequence:
- action: script.tradfri_transition
data:
entity_id: light.shion
color_temp: 143
transition: 2
brightness: '{% if states.sensor.aio_human_sensor_illuminance.state | float(0)
< 0.15 %} 160 {% else %} 255 {% endif %}'
- conditions:
- condition: trigger
id: 'off'
- condition: template
value_template: '{{ not is_state(''input_boolean.shionroom_mcl'', ''on'')
}}'
sequence:
- action: light.turn_off
target:
entity_id: light.shion
- action: timer.finish
target:
entity_id: timer.shionroom_timer
default: []
- alias: Shionroom Auto-on
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.shionroom_occupied
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ is_state(''binary_sensor.motion_sr_auto_on'', ''on'') }}'
actions:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.shionroom_occupied
state: 'on'
sequence:
- action: script.tradfri_transition
data:
entity_id: light.shion
color_temp: 143
transition: 2
brightness: '{% if states.sensor.aio_human_sensor_illuminance.state | float(0)
< 0.15 %} 160 {% else %} 255 {% endif %}'
default:
- action: light.turn_off
target:
entity_id: light.shion
- alias: SR light turned off
triggers:
- trigger: state
entity_id: light.shion
from: 'on'
to: 'off'
actions:
- action: timer.start
entity_id: timer.sr_mcl
- alias: SR light turned on
triggers:
- trigger: state
entity_id: light.shion
from: 'off'
to: 'on'
conditions:
- condition: template
value_template: '{{ is_state(''timer.sr_mcl'', ''active'') }}'
actions:
- action: input_boolean.toggle
entity_id: input_boolean.shionroom_mcl
- alias: SR MCL Announce State
triggers:
- trigger: state
entity_id: input_boolean.shionroom_mcl
conditions:
- condition: template
value_template: '{{ is_state(''input_boolean.audible_notifications'', ''on'')
}}'
actions:
- action: script.speech_engine_echo
data:
who: ai_3
voice: '{{ states(''input_select.jarvis_voice'') }}'
message: '{% set mode = ''自動'' if trigger.to_state.state == ''off'' else ''マニュアル''
%} <speak> シオンルームライトが {{ mode }} モードになりました。 </speak>
'
- alias: SR MCL Re-Enable
triggers:
- trigger: state
entity_id: input_boolean.shionroom_mcl
to: 'on'
for: 01:00:00
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.shionroom_mcl
- alias: Squirt Shion Airfreshener
triggers:
- trigger: state
entity_id: binary_sensor.shion_airfreshener_moving_target
from: 'off'
to: 'on'
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ is_state(''binary_sensor.motion_sr_auto_on'', ''on'') }}'
- condition: template
value_template: '{{ state_attr(''binary_sensor.shionroom_occupied'',''squirt'')
== true }}'
actions:
- action: switch.toggle
entity_id: switch.shion_airfreshener
- alias: SR Aircon
initial_state: true
triggers:
- trigger: template
value_template: '{{ (now() - states.binary_sensor.sr_ac_flaps_contact.last_changed).seconds
< 3 }}'
id: flaps
- trigger: state
entity_id: input_select.sr_ac_mode
id: mode
actions:
- choose:
- conditions:
- condition: trigger
id: mode
sequence:
- action: '{% if is_state(''input_select.sr_ac_mode'', ''Powerful Heat'') %}
script.sr_ac_powerful_heat
{% elif is_state(''input_select.sr_ac_mode'', ''Normal Heat'') %} script.sr_ac_normal_heat
{% elif is_state(''input_select.sr_ac_mode'', ''Silent Heat'') %} script.sr_ac_silent_heat
{% elif is_state(''input_select.sr_ac_mode'', ''Manual Heat'') %} script.sr_heat_man
{% elif is_state(''input_select.sr_ac_mode'', ''Powerful Cool'') %} script.sr_ac_powerful_cool
{% elif is_state(''input_select.sr_ac_mode'', ''Normal Cool'') %} script.sr_ac_normal_cool
{% elif is_state(''input_select.sr_ac_mode'', ''Silent Cool'') %} script.sr_ac_silent_cool
{% elif is_state(''input_select.sr_ac_mode'', ''Manual Cool'') %} script.sr_cool_man
{% elif is_state(''input_select.sr_ac_mode'', ''Normal Humidifier'') %}
script.sr_ac_normal_humidifier
{% elif is_state(''input_select.sr_ac_mode'', ''Ai Auto'') %} script.sr_ac_ai
{% elif is_state(''input_select.sr_ac_mode'', ''Man Auto'') %} script.sr_man_auto
{% elif is_state(''input_select.sr_ac_mode'', ''Fan'') %} script.sr_ac_fan
{% elif is_state(''input_select.sr_ac_mode'', ''Off'') %} script.sr_ac_off
{% endif %}
'
- conditions:
- condition: trigger
id: flaps
sequence:
- condition: template
value_template: '{{ not states(''binary_sensor.sr_ac_flaps_contact'').lower()
in [''unknown'',''unavailable'',''none''] }}'
- action: input_select.select_option
data:
entity_id: input_select.sr_ac_mode
option: "{% if (now() - states.input_select.sr_ac_mode.last_changed).seconds\
\ < 10 %}\n {{ states('input_select.sr_ac_mode') }}\n{% elif is_state('binary_sensor.sr_ac_flaps_contact',\
\ 'on') %} Man Auto\n{% elif is_state('binary_sensor.sr_ac_flaps_contact',\
\ 'off') %} Off\n{% else %}\n{% endif %}\n"
default: []
- alias: SR Aircon AM Schedule
triggers:
- trigger: state
entity_id:
- binary_sensor.sr_ac_am_automation_time_active
- binary_sensor.sr_ac_heat_required
- binary_sensor.sr_ac_cool_required
to: 'on'
for: 10
- trigger: state
entity_id: binary_sensor.shion_door
to: 'off'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.vacation_mode'', ''on'') }}'
- condition: state
entity_id: input_select.sr_ac_mode
state: 'Off'
- condition: state
entity_id: binary_sensor.shion_door
state: 'off'
- condition: state
entity_id: binary_sensor.sr_sensor_dht_status
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.sr_ac_heat_required
state: 'on'
- condition: state
entity_id: binary_sensor.sr_ac_cool_required
state: 'on'
- condition: state
entity_id: binary_sensor.sr_ac_am_automation_time_active
state: 'on'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.sr_ac_mode
option: "{% if is_state('binary_sensor.sr_ac_heat_required', 'on') %}\n Normal\
\ Heat\n{% elif is_state('binary_sensor.sr_ac_cool_required', 'on') %}\n \
\ Normal Cool\n{% else %}\n 'Off','Off'\n{% endif %}\n"
- alias: SR Aircon PM Schedule
triggers:
- trigger: state
entity_id:
- binary_sensor.sr_ac_pm_automation_time_active
- binary_sensor.sr_ac_heat_required
- binary_sensor.sr_ac_cool_required
to: 'on'
for: 10
- trigger: state
entity_id: binary_sensor.shion_door
to: 'off'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.vacation_mode'', ''on'') }}'
- condition: state
entity_id: input_select.sr_ac_mode
state: 'Off'
- condition: state
entity_id: binary_sensor.shion_door
state: 'off'
- condition: state
entity_id: binary_sensor.sr_sensor_dht_status
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.sr_ac_heat_required
state: 'on'
- condition: state
entity_id: binary_sensor.sr_ac_cool_required
state: 'on'
- condition: state
entity_id: binary_sensor.sr_ac_pm_automation_time_active
state: 'on'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.sr_ac_mode
option: "{% if is_state('binary_sensor.sr_ac_heat_required', 'on') %}\n Normal\
\ Heat\n{% elif is_state('binary_sensor.sr_ac_cool_required', 'on') %}\n \
\ Normal Cool\n{% else %}\n 'Off'\n{% endif %}\n"
- alias: SR Aircon AM Off
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.sr_ac_am_automation_time_active
to: 'off'
conditions:
- condition: state
entity_id: automation.sr_aircon_am_schedule
state: 'on'
- condition: template
value_template: '{{ states("input_select.sr_ac_mode") != "Off" }}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.sr_ac_mode
option: 'Off'
- alias: SR Aircon PM Off
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.sr_ac_pm_automation_time_active
to: 'off'
conditions:
- condition: state
entity_id: automation.sr_aircon_pm_schedule
state: 'on'
- condition: template
value_template: '{{ states("input_select.sr_ac_mode") != "Off" }}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.sr_ac_mode
option: 'Off'
- alias: SR Aircon Cool Temperature Adjust
initial_state: true
triggers:
- trigger: state
entity_id: input_number.sr_ac_temp_set_cool
conditions:
- condition: template
value_template: '{{ ''Cool'' in states.input_select.sr_ac_mode.state }}'
actions:
- action: '{% if states(''input_number.sr_ac_temp_set_cool'')| int != 0 %} script.sr_cool_man
{% endif %}
'
- action: input_select.select_option
data:
entity_id: input_select.sr_ac_mode
option: Manual Cool
- alias: SR Aircon Heat Temperature Adjust
initial_state: true
triggers:
- trigger: state
entity_id: input_number.sr_ac_temp_set_heat
conditions:
- condition: template
value_template: '{{ ''Heat'' in states.input_select.sr_ac_mode.state }}'
actions:
- action: '{% if states(''input_number.sr_ac_temp_set_heat'')| int != 0 %} script.sr_heat_man
{% endif %}
'
- action: input_select.select_option
data:
entity_id: input_select.sr_ac_mode
option: Manual Heat
- alias: SR Room Aircon Humidity Set
initial_state: true
triggers:
- trigger: state
entity_id: input_number.sr_humidity_set
conditions:
- condition: template
value_template: '{{ ''Cool'' in states.input_select.sr_ac_mode.state }}'
actions:
- action: '{% if states(''input_number.sr_humidity_set'')| int != 0 %} script.sr_humidity_set
{% endif %}
'
- alias: Item Select to speak
triggers:
- trigger: state
entity_id: input_select.speak_list
variables:
opt: '{% set sp = states(''input_select.speak_list'') %} {% set no = sp.find("(c")+2
%} {{ sp[no:no+2]|int(0) }}
'
conditions:
- condition: template
value_template: '{{states.input_select.speak_list.state = "do not use" }}'
actions:
- action: script.speech_engine
data:
who: '{{ states(''sensor.last_alexa'') }}'
voice: '{{ states(''input_select.jarvis_voice'') }}'
message: include ../tpl/speech/alexa_cmds.yaml
- action: input_select.select_option
data:
entity_id: input_select.speak_list
option: do not use
- delay: 2
- action: light.turn_on
data:
entity_id: light.alexa_virtual
brightness_pct: '{{opt}}'
- alias: Dummy light to item select
triggers:
- trigger: state
entity_id: light.alexa_virtual
from: 'off'
to: 'on'
actions:
- action: input_select.select_option
data:
entity_id: input_select.speak_list
option: "{% set slist = state_attr('input_select.speak_list','options') %} {%\
\ set opt = state_attr('light.alexa_virtual','brightness') %} {% set opt =\
\ (opt | float(0) / 255 * 100+0.5)|int %} {% if opt|int > slist|length %}\n\
\ {% set opt = 0 %}\n{% endif %} {{slist[opt]}} \n"
- action: light.turn_off
entity_id: light.alexa_virtual
- alias: Bedtime Start Announcements
triggers:
- trigger: time
at: input_datetime.shion_nightly_report
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: timer.start
entity_id: timer.looper
- alias: Bedtime Stop Announcements
triggers:
- trigger: state
entity_id: binary_sensor.middle
for: 30
from: 'off'
to: 'on'
conditions:
- condition: time
after: '21:00:00'
before: '22:30:00'
actions:
- action: timer.finish
entity_id: timer.looper
- alias: Looper timer started
triggers:
- trigger: event
event_type: timer.started
event_data:
entity_id: timer.looper
actions:
- action: "{% if now().hour > 21 %}\n timer.cancel\n{% else %}\n script.turn_on\n\
{% endif %}\n"
data:
entity_id: "{% if now().hour > 21 %}\n timer.looper\n{% else %}\n script.bedtime_notify\n\
{% endif %}\n"
- alias: Looper timer finished
triggers:
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.looper
conditions:
- condition: state
entity_id: binary_sensor.middle
state: 'off'
actions:
- action: timer.start
entity_id: timer.looper
- alias: Turn On Audible Notifications
initial_state: true
triggers:
- trigger: template
value_template: '{{ states(''sensor.time'') == (state_attr(''input_datetime.audible_notification_on'',
''timestamp'') | int | timestamp_custom(''%H:%M'', False)) }}'
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.audible_notifications
- alias: Turn Off Audible Notifications
initial_state: true
triggers:
- trigger: template
value_template: '{{ states(''sensor.time'') == (state_attr(''input_datetime.audible_notification_off'',
''timestamp'') | int | timestamp_custom(''%H:%M'', False)) }}'
conditions:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.audible_notifications
- alias: Shion Event Starting Soon
triggers:
- trigger: calendar
event: start
offset: -0:45:0
entity_id: calendar.shion_events
actions:
- action: script.status_annc
data:
who: ai_1
call_interuption: 1
call_shion_events: 1
- alias: Appointment Reminder Today
triggers:
- trigger: calendar
event: start
offset: '-1:00:00'
entity_id: calendar.appointments
actions:
- action: script.status_annc
data:
who: ai_1
call_interuption: 1
call_appointments: 1
- alias: Appointment Reminder Tomorrow
triggers:
- trigger: state
entity_id: sensor.appointmenttomorrow
conditions:
- condition: template
value_template: '{{ not is_state(''sensor.appointmenttomorrow'', [''unknown'',''none'',''unavailable''])
}}'
actions:
- action: script.email_notify
data:
who: duc
title: 'Appointment Tomorrow: {{ states(''sensor.appointmenttomorrow'') }}'
message: There is {{ states('sensor.appointmenttomorrow') }} appointment tomorrow
at {{ state_attr('sensor.appointmenttomorrow', 'start_time') }}.
- action: script.text_notify
data:
who: duc
title: Appointment Tomorrow
message: There is {{ states('sensor.appointmenttomorrow') }} appointment tomorrow
at {{ state_attr('sensor.appointmenttomorrow', 'start_time') }}.
- alias: announce who is arriving
triggers:
- trigger: state
entity_id:
- device_tracker.id
- device_tracker.ie
to: home
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Away'') or is_state(''input_select.home_mode'',
''Vacation'') }}'
sequence:
- action: input_select.select_option
entity_id: input_select.home_mode
data:
option: Returning
- action: script.standby
- action: input_boolean.turn_off
data:
entity_id: "{% if trigger.to_state.attributes.friendly_name == 'iE' %}\n\
\ input_boolean.eri_travel_monitor\n{% elif trigger.to_state.attributes.friendly_name\
\ == 'id' %}\n input_boolean.duc_travel_monitor\n{% else %}\n{% endif\
\ %}\n"
default:
- action: script.speech_engine
data:
who: '{{ states(''sensor.room_audio'') }}'
voice: '{{ states(''input_select.jarvis_voice'') }}'
message: "{% set alias = {\"iE\":\"mommy\", \"id\":\"daddy\", \"Shion\":\"\
she-on\"} %} {% set p = trigger.to_state.attributes.friendly_name %} {%\
\ set person = alias.get(p) %}\n {{ person }}, will be home in about 5\
\ minutes.\n"
- action: light.turn_on
data:
entity_id: light.g_1
brightness: 200
- action: input_boolean.turn_off
data:
entity_id: "{% if trigger.to_state.attributes.friendly_name == 'iE' %}\n \
\ input_boolean.eri_travel_monitor\n{% elif trigger.to_state.attributes.friendly_name\
\ == 'id' %}\n input_boolean.duc_travel_monitor\n{% else %}\n{% endif\
\ %}\n"
- alias: Momentary Switch Trigger
triggers:
- trigger: state
entity_id:
- input_boolean.toggle_guest_presence
- binary_sensor.duc_presence
to: 'on'
actions:
- action: switch.turn_on
data:
entity_id: "{% if is_state('input_boolean.toggle_guest_presence', 'on') %}\n\
\ switch.momentary_activate_guest\n{% elif is_state('binary_sensor.duc_presence',\
\ 'on') %}\n switch.momentary_activate_tv\n{% endif %}\n"
- delay: 2
- condition: template
value_template: '{{ is_state(''input_boolean.toggle_guest_presence'', ''off'')
}}'
- action: homeassistant.turn_off
data:
entity_id: input_boolean.toggle_guest_presence
- alias: welcome family announcement
triggers:
- trigger: state
entity_id:
- binary_sensor.duc_presence
- binary_sensor.eri_presence
- binary_sensor.shion_presence
to: 'on'
actions:
- wait_template: '{{ is_state(''group.motion_genkan_occupancy'', ''on'') }}'
continue_on_timeout: false
timeout: 20
- action: script.speech_engine
data:
who: ai_2
message: include ../tpl/speech/family_greetings.yaml
voice: '{{ states(''input_select.jarvis_voice'') }}'
- condition: template
value_template: '{{ not is_state(''switch.momentary_activate_guest'', ''on'')
}}'
- condition: template
value_template: '{{ states.sensor.lr_radar_illuminance.state | float(0) > 0.39
}}'
- action: script.turn_on_lr_lights
- alias: welcome guest announcement
triggers:
- trigger: state
entity_id:
- binary_sensor.sachiko_presence
- binary_sensor.tomokun_presence
to: 'on'
actions:
- delay: 1
- wait_template: '{{ is_state(''binary_sensor.genkan_moving_target'', ''on'') }}'
continue_on_timeout: false
timeout: 10
- action: script.speech_engine
data:
who: ai_2
message: include ../tpl/speech/guest_greetings.yaml
voice: '{{ states(''input_select.jarvis_voice'') }}'
- alias: Washer Operation
triggers:
- trigger: state
entity_id: sensor.gosund_washer_state
actions:
- action: input_select.select_option
data:
entity_id: input_select.gosund_washer_state
option: '{% set s = states(''input_select.gosund_washer_state'') %} {% set fr
= trigger.from_state.state %} {% set to = trigger.to_state.state %} {% if
fr == ''stop'' and to == ''fill'' %} wash fill {% elif fr == ''fill'' and
to == ''run'' %} wash {% elif fr in [''fill'', ''stop''] and to == ''run''
%} wash {% elif fr in [''run'', ''fill''] and to == ''pulse'' %} dryer {%
elif fr == ''run'' and to == ''pulse'' and s == ''wash'' %} wash spin {% elif
fr == ''pulse'' and to == ''run'' and s == ''wash spin'' %} wash drain {%
elif fr == ''pulse'' and to == ''run'' and s == ''unknown'' %} cool down {%
elif fr == ''run'' and to == ''fill'' %} rinse fill {% elif fr in [''fill'',
''run''] and to == ''wait'' %} rinse wait {% elif fr == ''wait'' and to ==
''run'' %} rinse {% elif fr == ''run'' and to == ''pulse'' and s == ''rinse''
%} rinse spin {% elif fr == ''pulse'' and to == ''run'' and s == ''rinse spin''
%} rinse drain {% elif fr in [''run'', ''fill'', ''wait'', ''unknown''] and
to == ''stop'' %} stop {% else %} -- {% endif %}
'
- alias: Washer Running
initial_state: true
triggers:
- trigger: state
entity_id: sensor.gosund_washer_state
from: wait
to: fill
- trigger: state
entity_id: sensor.gosund_washer_state
from:
- fill
- rinse
to: pulse
conditions:
- condition: numeric_state
entity_id: sensor.gosund_washer_power
above: 10
- condition: or
conditions:
- condition: state
entity_id: sensor.washer_status_m
state: idle
- condition: state
entity_id: sensor.washer_status_m
state: complete
actions:
- action: script.washer_running
- action: script.washer_monitor
- alias: Washer Complete
initial_state: true
triggers:
- trigger: numeric_state
entity_id: sensor.gosund_washer_power
below: 7
for: 36
id: done
- trigger: template
value_template: '{{ states(''sensor.gosund_washer_power'')| int(0) == 5 }}'
for: 18
id: filter
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id: done
sequence:
- condition: template
value_template: '{{ states(''sensor.gosund_washer_power'')| int(0) == 0 }}'
- condition: template
value_template: '{{ is_state(''sensor.washer_status_m'', ''running'') }}'
- action: script.washer_complete
- conditions:
- condition: trigger
id: filter
sequence:
- condition: template
value_template: '{{ is_state(''sensor.washer_status_m'', ''running'') and
is_state(''timer.washer_monitor'', ''idle'') }}'
- action: script.speech_engine
data:
who: '{{ states(''sensor.room_audio'') }}'
voice: '{{ states(''input_select.jarvis_voice'') }}'
message: It appears the washing machine check filter warning lamp is on.
- action: script.washer_complete
- conditions:
- condition: trigger
id: err
sequence:
- condition: template
value_template: '{{ is_state(''sensor.washer_status_m'', ''running'') and
is_state(''timer.washer_monitor'', ''active'') }}'
- action: script.speech_engine
data:
who: '{{ states(''sensor.room_audio'') }}'
message: It seems the washing machine ended with an error. Please verify.
voice: '{{ states(''input_select.jarvis_voice'') }}'
default: []
- alias: Washer Notification
initial_state: true
triggers:
- trigger: state
entity_id: sensor.washer_status_m
from: running
to: complete
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.washer_finished
- action: script.speech_engine
data:
who: '{{ states(''sensor.room_audio'') }}'
voice: '{{ states(''input_select.jarvis_voice'') }}'
message: Just a quick heads up, It appears the washing machine has completed
its cycle.
- action: script.turn_on
entity_id: script.washer_finished_notification_audible
- alias: Washer Emptied
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.washer_door
from: 'off'
to: 'on'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.washer_finished
- action: script.washer_emptied
- action: script.washer_monitor
- alias: Dish Cabinet Alert
mode: restart
triggers:
- trigger: template
value_template: '{{ is_state(''binary_sensor.dish_cabinet_contact'', ''on'') }}'
for: 120
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ is_state(''binary_sensor.dish_cabinet_contact'', ''on'')
}}'
sequence:
- action: script.status_annc
data:
who: '{{ states(''sensor.room_audio'') }}'
call_interuption: 1
call_secure_dish: 1
default: []
- alias: Morning Briefings
initial_state: true
variables:
msg: "Today is {{ now().strftime( '%B %d, %Y') }}\n \nToday's Weather\nThe current\
\ temperature is {{ states('sensor.wbio_current_temperature') }}° ( {{states('sensor.oa_feels_like')}}°\
\ feel like) with a forecast of {{ states('sensor.nws_overnight_forecast') }}.\
\ Today's low is {{ states('sensor.wbio_overnight_low') }}° with a high of {{\
\ states('sensor.wbio_daytime_temperature') }}°. The predicted precipitation\
\ today is{% if state_attr('sensor.my_weather_forecast_daily', 'forecast')[0].precipitation\
\ == 0 %} 0mm. {% else %} {{ states.sensor.my_weather_forecast_daily.attributes.forecast[0].precipitation\
\ }}mm at a chance of {{ states('sensor.wbio_current_rain_forecast') }}%. {%\
\ endif %}\n \nHolidays & Birthdays\n{% if is_state('sensor.holiday', 'none')\
\ %}No Holidays or Birthdays Today {% else %}Today is {{ states('sensor.holiday')\
\ }}.{% endif %} {% if is_state('sensor.holidaytomorrow', 'none') %} {% else\
\ %}Tomorrow is {{ states('sensor.holidaytomorrow') }}.{% endif %}\n{% if is_state('sensor.holidayinaweek',\
\ 'none') %} {% else %} {{ states('sensor.holidayinaweek') }} is in one week.{%\
\ endif %}\n\nA Picture of Us!"
triggers:
- trigger: time
at: input_datetime.morning_report
actions:
- action: script.email_notify_image
data:
who: duc
title: Morning Briefing
message: '{{ msg }}'
path:
- /config/www/img/private/{{ range(1, 25) | random }}.jpg
- action: script.text_notify
data:
who: duc
title: Weather
message: "Currently {{ states('sensor.aio_human_sensor_entrance_temperature',\
\ rounded=true) }}°, feels like {{states('sensor.oa_feels_like')}}°. Today\
\ {{ (state_attr('sensor.my_weather_forecast_daily', 'forecast')\n | map(attribute=\"\
temperature\")\n | list)[0:1]\n | max }}°\n/{{ state_attr('sensor.my_weather_forecast_daily',\
\ 'forecast')[0].templow }}° {{ states('weather.my_weather') }} humidity {{\
\ state_attr('weather.my_weather', 'humidity') }}% with {% if state_attr('sensor.my_weather_forecast_daily',\
\ 'forecast')[0].precipitation_probability != 0 %}\n preciptation of {{\
\ state_attr('sensor.my_weather_forecast_daily', 'forecast')[0].precipitation\
\ }}\n{%else%}\n no precipitation\n{%endif%}."
- action: script.email_notify_image
data:
who: eri
title: Morning Briefing
message: '{{ msg }}'
path:
- /config/www/img/private/{{ range(1, 25) | random }}.jpg
- alias: Morning Wakeup Report
triggers:
- trigger: state
entity_id: binary_sensor.bt_proxy_computer_moving_target
to: 'on'
conditions:
- condition: time
after: 05:00:00
before: 06:00:00
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ not is_state(''sensor.eri_bermuda_area'', ''Living'') }}'
- condition: state
entity_id: input_boolean.morning_wakeup_report
state: 'off'
actions:
- action: script.morning_wakeup_report
- action: input_boolean.turn_on
entity_id: input_boolean.morning_wakeup_report
- alias: Morning Report
triggers:
- trigger: state
entity_id: binary_sensor.bt_proxy_computer_moving_target
to: 'on'
conditions:
- condition: time
after: input_datetime.morning_report
before: 08:30:00
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ not is_state(''sensor.eri_bermuda_area'', ''Living'') }}'
- condition: state
entity_id: input_boolean.good_morning_report
state: 'off'
actions:
- action: script.morning_briefing
- action: script.battery_notification
- action: input_boolean.turn_on
entity_id: input_boolean.good_morning_report
- alias: Daily Report
triggers:
- trigger: state
entity_id: binary_sensor.bt_proxy_computer_moving_target
to: 'on'
conditions:
- condition: time
after: input_datetime.daily_report
before: '15:00:00'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: state
entity_id: input_boolean.daily_report
state: 'off'
actions:
- action: script.daily_briefing
- action: input_boolean.turn_on
entity_id: input_boolean.daily_report
- alias: Enable Cameras at Sunset
initial_state: true
triggers:
- trigger: sun
event: sunset
offset: -00:03:00
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: script.sundown_briefing
- alias: Nightly Briefing
triggers:
- trigger: time
at: input_datetime.nightly_briefing
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: script.nightly_briefing
- alias: Event Briefing
triggers:
- trigger: time
at: input_datetime.event_briefing
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: script.event_briefing
- alias: Security MDF Camera Snapshot
mode: queued
max_exceeded: silent
triggers:
- trigger: state
entity_id: binary_sensor.gk_airfreshener_moving_target
from: 'off'
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.security_cameras
state: 'on'
actions:
- delay: 2
- action: camera.snapshot
data:
entity_id: camera.security_mdf
filename: /config/www/img/security/mdf/{{ now().strftime("%Y%m%d_%H%M%S") }}security_mdf_camera.jpg
- action: shell_command.clean_security_images
- alias: Security Balcony Camera Snapshot
mode: queued
max_exceeded: silent
triggers:
- trigger: state
entity_id: binary_sensor.security_balcony_occupancy
from: 'off'
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.security_cameras
state: 'on'
actions:
- action: camera.snapshot
data:
entity_id: camera.security_balcony
filename: /config/www/img/security/balcony/security_balcony_camera_last.jpg
- delay: 1
- action: camera.snapshot
data:
entity_id: camera.security_balcony
filename: /config/www/img/security/balcony/{{ now().strftime("%Y%m%d_%H%M%S")
}}security_balcony_camera.jpg
- action: shell_command.clean_balcony_images
- alias: Automate Christmas Lights
triggers:
- trigger: numeric_state
entity_id: sensor.lr_radar_illuminance
above: 0.38
below: 0.51
- trigger: time
at: '23:00:00'
- trigger: numeric_state
entity_id: sensor.lr_radar_illuminance
below: 0.28
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.vacation_mode'', ''on'') }}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
choose:
- conditions: '{{ states(''sensor.lr_radar_illuminance'')| float(0) < 0.29 or
now().hour == 23 and now().minute == 00 }}'
sequence:
- action: script.christmas_lights_off
- conditions: '{{ states(''sensor.lr_radar_illuminance'')| float(0) > 0.38 }}'
sequence:
- action: script.christmas_lights_on
- alias: turn on appletv netflix
triggers:
- trigger: state
entity_id: input_boolean.appletv_netflix
from: 'off'
to: 'on'
actions:
- action: script.appletv_netflix
- action: input_boolean.toggle
entity_id: input_boolean.appletv_netflix
- alias: turn on appletv plex
triggers:
- trigger: state
entity_id: input_boolean.appletv_plex
from: 'off'
to: 'on'
actions:
- action: script.appletv_plex
- action: input_boolean.toggle
entity_id: input_boolean.appletv_plex
- alias: Turn on desktop in morning
triggers:
- trigger: time
at: 04:15:00
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.vacation_mode'', ''on'') }}'
- condition: template
value_template: '{{ is_state(''binary_sensor.duc_presence'', ''on'') }}'
- condition: template
value_template: '{{ not is_state(''binary_sensor.desktop_status'', ''on'') }}'
actions:
- action: switch.turn_on
entity_id: switch.desktop
- alias: Server Status
triggers:
- trigger: template
value_template: '{{ not is_state(''sensor.server_status'', ''on'') }}'
for: 600
id: offline
actions:
- choose:
- conditions:
- condition: trigger
id: offline
sequence:
- condition: template
value_template: '{{ not is_state(''sensor.server_status'', ''on'') }}'
- action: script.email_notify
data:
who: duc
title: Server Offline
message: '{{ states(''sensor.server_status'') }} appears to be {{ states(''group.server_status'')
}}line.'
default:
- action: script.email_notify
data:
who: duc
title: Server Online
message: Servers appear to be {{ states('group.server_status') }}line.
- alias: disable device internet
triggers:
- trigger: template
value_template: '{{ states(''sensor.time'') == states(''sensor.disable_internet'')[0:5]
}}'
actions:
- action: switch.turn_on
entity_id: switch.ipad
- alias: AIO Controller Events
id: aio_controller_events
triggers:
- trigger: state
entity_id: event.aio_controller_action
to: null
conditions:
- condition: template
value_template: '{{trigger.from_state.state != ''unavailable''}}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{trigger.to_state.attributes.event_type == ''brightness_up_click''}}'
sequence:
- action: script.turn_on
target:
entity_id: script.dining_lights_toggle
- conditions:
- condition: template
value_template: '{{trigger.to_state.attributes.event_type == ''brightness_down_click''}}'
sequence:
- action: light.toggle
target:
entity_id: light.living
- conditions:
- condition: template
value_template: '{{trigger.to_state.attributes.event_type == ''arrow_left_click''}}'
sequence:
- action: script.turn_on
target:
entity_id: script.cr_curtains_toggle
- conditions:
- condition: template
value_template: '{{trigger.to_state.attributes.event_type == ''arrow_right_click''}}'
sequence:
- action: script.turn_on
target:
entity_id: script.lr_curtains_toggle
- conditions:
- condition: template
value_template: '{{trigger.to_state.attributes.event_type == ''arrow_left_hold''}}'
sequence:
- action: script.turn_on
target:
entity_id: script.lr_ac_cool_toggle
- conditions:
- condition: template
value_template: '{{trigger.to_state.attributes.event_type == ''arrow_right_hold''}}'
sequence:
- action: script.turn_on
target:
entity_id: script.lr_ac_heat_toggle
- conditions:
- condition: template
value_template: '{{trigger.to_state.attributes.event_type == ''toggle''}}'
sequence:
- action: light.turn_off
target:
entity_id:
- light.living
- light.ceiling_fan_light
- alias: turn on light flash
triggers:
- trigger: state
entity_id: input_boolean.lights_flash
from: 'off'
to: 'on'
actions:
- action: script.light_loop
- alias: turn off light flash
triggers:
- trigger: state
entity_id: input_boolean.lights_flash
from: 'on'
to: 'off'
actions:
- action: homeassistant.turn_off
entity_id: script.light_loop, script.light_flash
- alias: Flight entry notification
triggers:
- trigger: event
event_type: flightradar24_entry
conditions: []
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.event.data.tracked_by_device == ''homeFT24'' and
is_state(''person.duc'', ''home'') }}'
- condition: template
value_template: '{{ trigger.event.data.airline | lower | regex_search(''police|fire|safety|operation|university|shizuoka|kawasaki|tohohu|teikyo|okayama|hiratagakuen|asahi'')
}}'
sequence:
- action: notify.amberthebot
data:
message: 🚁{{ trigger.event.data.airline }} is flying in your neighborhood.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.tracked_by_device == ''homeFT24'' and
is_state(''person.duc'', ''home'') }}'
- condition: template
value_template: '{{ trigger.event.data.airline | lower | regex_search(''private
owner|honda|none|Private owner'') }}'
- condition: template
value_template: '{{ trigger.event.data.callsign | lower | regex_search(''blocked|none|n'')
}}'
sequence:
- action: notify.amberthebot
data:
message: ‼️ No flight plan. The aircraft is either private or goverment
operated.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.tracked_by_device == ''jcbFT24'' and
is_state(''person.duc'', ''jcb'') }}'
- condition: template
value_template: '{{ trigger.event.data.airline | lower | regex_search(''police|fire|safety|operation|university|shizuoka|kawasaki|tohohu|teikyo|okayama|hiratagakuen|asahi'')
}}'
sequence:
- action: notify.amberthebot
data:
message: 🚁{{ trigger.event.data.airline }} is flying in your neighborhood.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.tracked_by_device == ''jcbFT24'' and
is_state(''person.duc'', ''jcb'') }}'
- condition: template
value_template: '{{ trigger.event.data.airline | lower | regex_search(''private
owner|honda|none|Private owner'') }}'
- condition: template
value_template: '{{ trigger.event.data.callsign | lower | regex_search(''blocked|none|n'')
}}'
sequence:
- action: notify.amberthebot
data:
message: ‼️ No flight plan. The aircraft is either private or goverment
operated.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.tracked_by_device == ''homeFT24'' and
is_state(''person.duc'', ''home'') }}'
sequence:
- action: notify.amberthebot
data:
message: 📍The plane you hear now is from {{ trigger.event.data.airline }}\[{{
trigger.event.data.callsign }}] at {{ "{:,.0f}".format(trigger.event.data.altitude)
}} ft. It comes from {{ trigger.event.data.airport_origin_city }} in {{
trigger.event.data.airport_origin_country_name }} and is on its way to
{{ trigger.event.data.airport_destination_city }}.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.tracked_by_device == ''jcbFT24'' and
is_state(''person.duc'', ''jcb'') }}'
sequence:
- action: notify.amberthebot
data:
message: 💼The plane you hear now is from {{ trigger.event.data.airline }}\[{{
trigger.event.data.callsign }}] at {{ "{:,.0f}".format(trigger.event.data.altitude)
}} ft. It comes from {{ trigger.event.data.airport_origin_city }} in {{
trigger.event.data.airport_origin_country_name }} and is on its way to
{{ trigger.event.data.airport_destination_city }}.
default: []
- alias: Scheduled flight takes off
triggers:
- trigger: event
event_type: flightradar24_tracked_took_off
actions:
- action: notify.amberthebot
data:
message: The plane you hear now is from {{ trigger.event.data.airline }}\[{{
trigger.event.data.callsign }}]. It took off from {{ trigger.event.data.airport_origin_city
}} in {{ trigger.event.data.airport_origin_country_name }} and is on its way
to {{ trigger.event.data.airport_destination_city }}.
- alias: motion hallway auto-on
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.hallway_occupied
to: 'on'
conditions:
- condition: template
value_template: '{{ not is_state(''input_select.home_mode'', ''Vacation'') }}'
actions:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: 'on'
sequence:
- action: script.tradfri_transition
data:
entity_id: light.h_1
color_temp: 400
transition: 2
brightness: 200
entity_id: light.h_1
- conditions:
- condition: template
value_template: '{{ now().hour > 19 or now().hour < 7 or is_state(''binary_sensor.hallway_nightlight'',
''on'') }}'
sequence:
- action: script.tradfri_transition
data:
entity_id: light.h_1
color_temp: 400
transition: 2
brightness: 50
entity_id: light.h_1
default:
- action: script.tradfri_transition
data:
entity_id: light.h_1
color_temp: 400
transition: 2
brightness: 200
entity_id: light.h_1
- alias: motion hallway auto-off
triggers:
- trigger: state
entity_id: binary_sensor.hallway_occupied
to: 'off'
- trigger: template
value_template: '{{ state_attr(''binary_sensor.hallway_occupied'', ''nightlight'')
== true }}'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
or state_attr(''binary_sensor.hallway_occupied'', ''nightlight'') == true }}'
actions:
- action: light.turn_off
entity_id: light.h_1
- alias: motion genkan area
triggers:
- trigger: state
entity_id: binary_sensor.genkan_occupied
to: 'on'
- trigger: template
value_template: '{{ is_state(''binary_sensor.genkan_occupied'', ''off'') }}'
for: 10
id: 'off'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
actions:
- choose:
- conditions:
- condition: trigger
id: 'off'
sequence:
- action: light.turn_off
entity_id: light.g_1
default:
- action: script.tradfri_transition
entity_id: light.g_1
data:
entity_id: light.g_1
color_temp: 400
transition: 2
brightness: 200
- alias: Genkan Airfreshener auto-on
triggers:
- trigger: state
entity_id: binary_sensor.genkan_moving_target
from: 'off'
to: 'on'
conditions:
- condition: template
value_template: "{%- set trig = (now() - states.switch.gk_airfreshener.last_changed).seconds\
\ -%}\n {{ trig >= 3600 }}"
actions:
- action: switch.turn_on
entity_id: switch.gk_airfreshener
- alias: Skills Ask - Turn on LR Aircon
triggers:
- trigger: state
entity_id: binary_sensor.duc_presence
to: 'on'
for: 00:00:30
- trigger: numeric_state
entity_id: sensor.lr_radar_temperature
above: input_number.lr_ac_cool_temp_set
for: 00:00:20
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ is_state(''input_select.lr_ac_mode'', ''Off'') }}'
- condition: template
value_template: '{{ states(''sensor.lr_radar_temperature'') | float(default=24)
> states(''input_number.lr_ac_cool_temp_set'') | float(default=25) }}'
actions:
- action: script.activate_alexa_actionable_notification
data:
text: The current livingroom temperature is {{ states("sensor.lr_radar_temperature")
}} degree celsius. Would you like me to turn on the livingroom AC?
event_id: ask_to_turn_on_lr_aircon
who: media_player.ai_1
- alias: Skills Rsp - Turn on LR Aircon
triggers:
- trigger: event
event_type: alexa_actionable_notification
event_data:
event_id: ask_to_turn_on_lr_aircon
event_response_type: ResponseYes
actions:
- action: switch.turn_on
entity_id: switch.ac_lr_unit
- alias: BPM Record Log Duc
triggers:
- trigger: state
entity_id: sensor.duc_withings_systolic_blood_pressure, sensor.duc_withings_diastolic_blood_pressure
actions:
- action: script.text_notify
data:
who: amber
title: 'BP Readings:'
message: '{% set t = as_timestamp(states.sensor.duc_withings_systolic_blood_pressure.last_changed)
| timestamp_custom(''%-I:%M %p'') %} Your last BP reading was {{ states(''sensor.duc_withings_systolic_blood_pressure'')
}}/{{ states(''sensor.duc_withings_diastolic_blood_pressure'') }} taking at
{{ t }}.
'
- action: notify.send_message
target:
entity_id: notify.bpm_log_duc
data:
message: '{{ states(''sensor.date'') }},{{ states(''sensor.time'') }},{{ states(''sensor.duc_withings_heart_pulse'')
}},{{ states(''sensor.duc_withings_systolic_blood_pressure'') }},/,{{ states(''sensor.duc_withings_diastolic_blood_pressure'')
}}'
- alias: Weight Record Log Duc
triggers:
- trigger: state
entity_id: sensor.duc_withings_weight, sensor.duc_withings_fat_ratio
actions:
- action: script.text_notify
data:
who: amber
title: 'Today\`s Weight:'
message: '{% set t = as_timestamp(states.sensor.duc_withings_weight.last_changed)
| timestamp_custom(''%-I:%M %p'') %} Your weight recorded at {{ t }} is {{
states(''sensor.duc_withings_weight'') }}.
'
- action: notify.send_message
target:
entity_id: notify.weight_log_duc
data:
message: '{{ states(''sensor.date'') }},{{ states(''sensor.time'') }},{{ states(''sensor.duc_withings_bone_mass'')
}},{{ states(''sensor.duc_withings_fat_free_mass'') }},{{ states(''sensor.duc_withings_fat_mass'')}},{{
states(''sensor.duc_withings_fat_ratio'')}},{{ states(''sensor.duc_withings_heart_pulse'')}},{{
states(''sensor.duc_withings_hydration'') }},{{ states(''sensor.duc_withings_muscle_mass'')}},{{
states(''sensor.duc_withings_visceral_fat_index'') }},{{ states(''sensor.duc_withings_weight'')
}}'
- alias: Backup Config Github
triggers:
- trigger: time
at: '18:00:00'
actions:
- action: shell_command.update_github
- alias: Sensor Low Battery
initial_state: true
triggers:
- trigger: numeric_state
entity_id:
- sensor.motion_security_battery
- sensor.aio_controller_battery
- sensor.shion_room_battery
- sensor.computer_room_battery
- sensor.living_room_battery
- sensor.meter_battery
- sensor.jcom_tv_box_battery
- sensor.floor_heat_battery
- sensor.hallway_door_battery
- sensor.genkan_door_battery
- sensor.24hr_fan_battery
- sensor.washer_door_battery
- sensor.master_dimmer_battery
- sensor.shion_dimmer_battery
- sensor.lr_curtains_battery
- sensor.cr_curtains_battery
- sensor.shower_room_battery
- sensor.motion_s1_battery
- sensor.motion_c1_battery
below: 46
actions:
- action: notify.notify_events
data:
message: The battery for {{ trigger.to_state.attributes.friendly_name }} is
below 46 percent.
- alias: startup automations
initial_state: true
triggers:
- trigger: homeassistant
event: start
actions:
- action: frontend.set_theme
data:
name: midnight
- delay: 25
- action: script.set_device_tracker_shion
- delay: 15
- action: automation.trigger
entity_id: automation.presence_restart_daily
- delay: 270
- action: script.set_device_tracker_shion
- action: script.update_critical_battery_group
- alias: Refresh special event sensors
initial_state: true
triggers:
- trigger: time
at: 00:00:01
- trigger: homeassistant
event: start
actions:
- action: python_script.special_events
data:
name: Duc
type: birthday
date: secret duc_bday
- action: python_script.special_events
data:
name: Eri
type: birthday
date: secret eri_bday
- action: python_script.special_events
data:
name: Shion
type: birthday
date: secret shion_bday
- action: python_script.special_events
data:
name: Our wedding
type: anniversary
date: secret wed_anniversary
- action: python_script.special_events
data:
name: Golden Week
type: holiday
date: 29/04/2023
- action: script.mailbox_reset
- action: python_script.set_state
data:
entity_id: sensor.lora_mailbox
state: received
- alias: Renable Shion Devices
initial_state: true
triggers:
- trigger: time
at: 02:00:00
actions:
- action: script.enable_devices
- alias: Update Template Sensors
initial_state: true
triggers:
- trigger: time_pattern
minutes: /59
actions:
- action: homeassistant.update_entity
entity_id:
- sensor.number_of_lines_of_code
- sensor.sensor_count
- sensor.automation_count
- sensor.tracker_count
- sensor.script_count
- sensor.switch_count
- sensor.binary_sensor_count
- sensor.light_count
- alias: New Home Assistant Version
initial_state: true
triggers:
- trigger: state
entity_id: sensor.hassio_version
conditions:
- condition: template
value_template: '{{ states(''sensor.hassio_version'') = ''unavailable'' }}'
- condition: template
value_template: '{{ trigger.from_state.state = ''unavailable'' }}'
actions:
- action: notify.notify_events
data:
message: Home Assistant Version {{ states.sensor.hassio_version.state }} is
available
- alias: persistent_notification_clear_pwned
mode: parallel
triggers:
- trigger: event
event_type: call_service
event_data:
domain: persistent_notification
service: create
conditions:
- condition: template
value_template: '{{ ''supervisor_issue_pwned'' in trigger.event.data.service_data.notification_id
}}
'
actions:
- action: persistent_notification.dismiss
data:
notification_id: '{{ trigger.event.data.service_data.notification_id }}
'
- alias: persistent_notification_clear_ip
mode: single
triggers:
- trigger: state
entity_id: persistent_notification.http_login
to: notifying
conditions:
- condition: template
value_template: "{% if states.persistent_notification.http_login.state is defined\
\ %}\n {% set str= state_attr('persistent_notification.http_login', 'message')\
\ %}\n {% set ip=(str|regex_findall_index('[\\d.]+')) %}\n {{ ip in ['192.168.1.111']\
\ }}\n{% else %}\n false\n{% endif %}\n"
actions:
- action: persistent_notification.dismiss
data:
notification_id: http-login
- alias: Restore Samba Backup sensor on startup
triggers:
- trigger: homeassistant
event: start
actions:
- action: hassio.addon_stdin
data:
addon: 15d21743_samba_backup
input: restore-sensor
- alias: Kitchen Occupancy
description: Defines occupancy state for room
mode: single
triggers:
- trigger: time_pattern
id: time
seconds: '10'
- trigger: state
entity_id: group.motion_kitchen_occupancy
id: motion
to: 'on'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
- condition: template
value_template: '{{ is_state(''input_boolean.kitchen_mcl'', ''off'') }}'
actions:
- action: python_script.room_occupancy
data:
roomname: kitchen
timeout: '{{ 3 if is_state(''group.cooking_time'', ''on'') else 2 }}'
entities_toggle:
- group.motion_kitchen_occupancy
entities_keep:
- binary_sensor.kitchen_still_target
- binary_sensor.cabinet_has_target
- alias: Kitchen Light
description: toggle light depending on timer state
mode: single
triggers:
- trigger: state
entity_id: timer.kitchen_timer
id: pre
from: idle
to: active
- trigger: state
entity_id: light.cabinet
id: 'on'
from: 'off'
to: 'on'
for: 00:01:00
- trigger: state
entity_id: sensor.kt_illuminance
id: 'on'
from: 'off'
to: 'on'
- trigger: state
entity_id: timer.kitchen_timer
id: 'off'
from: active
to: idle
- trigger: state
entity_id: light.cabinet
id: 'off'
from: 'on'
to: 'off'
- trigger: template
value_template: "{%- set trig = (now() - states.group.motion_kitchen_occupancy.last_changed).seconds\
\ -%}\n {{ is_state('binary_sensor.kitchen_presence', 'off') and trig > 5 }}"
id: 'off'
for: 40
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
actions:
- choose:
- conditions:
- condition: trigger
id: pre
sequence:
- action: light.turn_on
data:
entity_id: "{% if is_state('binary_sensor.lr_radar_status', 'off') %}\n\
\ light.k_1, light.k_3\n{% elif states.sensor.lr_radar_illuminance.state\
\ | float <= 0.09 %}\n light.k_1\n{% else %}\n light.k_1, light.k_3\n\
{% endif %}\n"
- conditions:
- condition: trigger
id: 'on'
sequence:
- condition: template
value_template: '{{ is_state(''light.cabinet'', ''on'') }}'
- service_template: script.motion_kitchen_lights_illuminance_{{ 'offline' if
is_state('binary_sensor.lr_radar_status', 'off') else 'online' }}
- conditions:
- condition: trigger
id: 'off'
sequence:
- action: light.turn_off
entity_id: light.cabinet, light.counter
- action: timer.finish
entity_id: timer.kitchen_timer
default: []
- alias: Kitchen Auto-on
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.kitchen_occupied
id: pre
from: 'off'
to: 'on'
- trigger: template
value_template: '{{ state_attr(''binary_sensor.kitchen_occupied'', ''full_on'')
== true }}'
id: 'on'
- trigger: state
entity_id: sensor.kt_illuminance
id: 'on'
from: 'off'
to: 'on'
- trigger: state
entity_id: light.cabinet
id: 'off'
from: 'on'
to: 'off'
- trigger: state
entity_id: binary_sensor.kitchen_occupied
id: 'off'
from: 'on'
to: 'off'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
actions:
- choose:
- conditions:
- condition: trigger
id: pre
sequence:
- action: light.turn_on
data:
entity_id: "{% if is_state('binary_sensor.lr_radar_status', 'off') %}\n\
\ light.k_1, light.k_3\n{% elif states.sensor.lr_radar_illuminance.state\
\ | float <= 0.09 %}\n light.k_1\n{% else %}\n light.k_1, light.k_3\n\
{% endif %}\n"
- conditions:
- condition: trigger
id: 'on'
sequence:
- condition: template
value_template: '{{ is_state(''light.cabinet'', ''on'') }}'
- service_template: script.motion_kitchen_lights_illuminance_{{ 'offline' if
is_state('binary_sensor.lr_radar_status', 'off') else 'online' }}
- conditions:
- condition: trigger
id: 'off'
sequence:
- action: light.turn_off
entity_id: light.cabinet, light.counter
- action: timer.finish
entity_id: timer.kitchen_timer
default: []
- alias: Kitchen MCL Announce State
triggers:
- trigger: state
entity_id: input_boolean.kitchen_mcl
conditions:
- condition: template
value_template: '{{ is_state(''input_boolean.audible_notifications'', ''on'')
}}'
actions:
- action: script.speech_engine
data:
who: ai_1
message: include ../tpl/speech/control_status.yaml
voice: '{{ states(''input_select.jarvis_voice'') }}'
- alias: Kitchen MCL Re-Enable
triggers:
- trigger: state
entity_id: input_boolean.kitchen_mcl
to: 'on'
for: 01:00:00
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.kitchen_mcl
- alias: computer room lights auto-on
triggers:
- trigger: numeric_state
entity_id: sensor.lr_radar_illuminance
above: 0.31
below: 0.41
conditions:
- condition: or
conditions:
- condition: state
entity_id: sensor.eri_home_location
state: not_home
- condition: time
after: 07:59
before: '20:00'
- condition: template
value_template: '{{ is_state(''binary_sensor.duc_presence'', ''on'') }}'
- condition: template
value_template: '{{ not is_state(''input_select.home_mode'', ''Vacation'') }}'
actions:
- action: script.ashley_fadein
data:
entity_id: light.computer
sec: 150
mode: restart
- alias: livingroom lights auto-on
triggers:
- trigger: numeric_state
entity_id: sensor.lr_radar_illuminance
id: pre
above: 0.31
below: 0.41
- trigger: state
entity_id: sensor.period_of_the_day
to: dusklight
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
- condition: time
after: 07:59
before: '20:00'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ not is_state(''input_select.home_mode'', ''Vacation'') }}'
- condition: or
conditions:
- condition: template
value_template: '{{ is_state(''sensor.date_weekday'', ''off'') or is_state(''binary_sensor.shion_presence'',
''on'') }}'
- condition: template
value_template: '{{ states(''sensor.holiday'')| trim != ''none'' }}'
actions:
- choose:
- conditions:
- condition: trigger
id: pre
sequence:
- action: script.ashley_fadein
data:
entity_id: light.living
sec: 150
default:
- action: light.turn_on
data:
brightness_pct: 100
target:
entity_id: light.living
mode: restart
- alias: front area lights auto-off
triggers:
- trigger: template
value_template: '{{ states(''sensor.lr_radar_illuminance'') | float(0) < 0.27
and states(''sensor.lr_radar_illuminance'') != ''unavailable'' and states(''sensor.time'')
>= ''05:00'' }}'
- trigger: template
value_template: '{{ states(''sensor.lr_radar_illuminance'') | float(0) < 0.27
and states(''sensor.lr_radar_illuminance'') != ''unavailable'' }}'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.guest_mode'', ''on'') }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'',
''on'') }}'
- condition: template
value_template: '{{ states(''sensor.time'') > ''05:00'' }}'
sequence:
- action: light.turn_off
entity_id: light.computer, light.living
- action: script.turn_off
data:
entity_id: script.ashley_fadein
- conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'',
''on'') }}'
- condition: template
value_template: '{{ states(''sensor.date_weekday'') == ''off'' }}'
sequence:
- action: light.turn_off
entity_id: light.computer, light.living
- action: script.turn_off
data:
entity_id: script.ashley_fadein
default:
- action: light.turn_off
entity_id: light.computer
- action: script.turn_off
data:
entity_id: script.ashley_fadein
- alias: Notify about expiring inventory items
trigger:
- platform: numeric_state
entity_id: sensor.items_expiring_soon
above: 0
- platform: time
at: 06:00:00
condition:
- condition: numeric_state
entity_id: sensor.items_expiring_soon
above: 0
action:
- service: notify.mobile_app_id
data:
title: 🗓️ Inventory Items Expiring Soon
message: "{% set expiring = state_attr('sensor.items_expiring_soon', 'expiring_items')\
\ %} {% set expired = state_attr('sensor.items_expiring_soon', 'expired_items')\
\ %} {% if expired %}\n ⚠️ {{ expired | length }} expired items: {{ expired[:3]\
\ | map(attribute='name') | join(', ') }}\n{% endif %} {% if expiring %}\n\
\ \U0001F4C5 {{ expiring | length }} expiring soon: {{ expiring[:3] | map(attribute='name')\
\ | join(', ') }}\n{% endif %}\n"
data:
actions:
- action: view_inventory
title: View Inventory
- alias: Clean Nozzle Filters
triggers:
- trigger: state
entity_id: sensor.season
conditions:
- condition: template
value_template: '{{ not is_state(''input_select.home_mode'', ''Vacation'') }}'
actions:
- action: switch.toggle
entity_id: group.clean_aircon_filter
- action: script.toilet_nozzle_cleaning
- alias: wakeup light bedroom
triggers:
- trigger: template
value_template: '{{ states(''sensor.time'') == states(''sensor.wakeup_start_time_lights'')
}}'
conditions:
- condition: state
entity_id: input_boolean.wakeup
state: 'on'
- condition: template
value_template: '{{ states(''sensor.holiday'')| trim == ''none'' }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.wakeup_weekends
state: 'on'
- condition: template
value_template: '{{ is_state(''sensor.date_weekday'', ''on'') }}'
actions:
- action: python_script.smooth_fader
data:
entity_id: '{{ states(''sensor.wakeup_map'') }}'
duration: 00:{{ states('input_number.wakeup_duration')|int }}:00
brightness_start: '{{ states(''input_number.brightness_start'')|int }}'
brightness_end: '{{ states(''input_number.brightness_end'')|int }}'
brightness_curve: exp5
temperature_curve: exp5
- alias: Daily Entity Refresh
triggers:
- trigger: time
at: '17:00:00'
actions:
- action: homeassistant.update_entity
entity_id: sensor.school_tomorrow
- alias: Good Night
initial_state: true
triggers:
- trigger: time
at: '22:15:00'
actions:
- action: script.turn_on
entity_id: script.school_year_over
- action: input_boolean.turn_off
entity_id: input_boolean.school_today
- action: input_boolean.turn_off
entity_id: input_boolean.audible_notifications
- action: input_boolean.turn_off
entity_id: input_boolean.good_morning_report
- action: input_boolean.turn_off
entity_id: input_boolean.morning_wakeup_report
- action: input_boolean.turn_off
entity_id: input_boolean.daily_report
- action: script.reset_earthquake_daily_count
- action: input_boolean.turn_off
entity_id: input_boolean.jcom_tv
- action: script.text_notify_image
data:
who: amber
image: "{{ [ \"/config/www/img/misc/off-01.jpg\",\n \"/config/www/img/misc/off-02.jpg\"\
,\n \"/config/www/img/misc/off-03.jpg\",\n \"/config/www/img/misc/off-04.jpg\"\
] | random }}"
caption: '{{ [ "Good Night from Lions Mansion. ", "Time to shut down this party.
Good Night from Lions Mansion. ", "I''m feeling tired. Think I''ll take a
quick nap. Good Night!", "Things are getting quiet. Time to say Good Night.",
"We have come to the end of our broadcast day. Oh, who am I kidding. I''''ll
be up all night watching over Lions Mansion. " ] | random }}'
- alias: Set Room Presence
mode: restart
triggers:
- trigger: state
entity_id: sensor.room_audio
actions:
- action: input_text.set_value
data:
entity_id: input_text.room_presence
value: '{{ states(''sensor.room_audio'') }}'
- action: mqtt.publish
data:
topic: house/alerts/presence/current_room
payload: '{{ states(''sensor.room_audio'') }}'
retain: true
- alias: Eri Arrives at Costco Notification
initial_state: true
triggers:
- trigger: zone
event: enter
zone: zone.costco_hq
entity_id: person.eri
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.eri_travel_monitor
- action: script.status_annc
data:
who: '{{ states(''sensor.room_audio'') }}'
speech_message: Just a quick heads up. Eddie has arrived at work.
- alias: Eri Leaves Costco Notification
initial_state: true
triggers:
- trigger: zone
event: leave
zone: zone.costco_hq
entity_id: person.eri
actions:
- action: script.text_notify
data:
who: duc
title: '*Notification*'
message: Eri has left work.
- action: input_boolean.turn_on
entity_id: input_boolean.eri_travel_monitor
- action: script.status_annc
data:
who: '{{ states(''sensor.room_audio'') }}'
call_interuption: 1
call_eri_location: 1
- alias: Duc Arrives at Jcb Notification
initial_state: true
triggers:
- trigger: zone
event: enter
zone: zone.jcb
entity_id: person.duc
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.duc_travel_monitor
- action: script.status_annc
data:
who: '{{ states(''sensor.room_audio'') }}'
speech_message: I do not mean to intrude, but, Duck has arrived at work.
- alias: Duc Leaves Jcb Notification
initial_state: true
triggers:
- trigger: zone
event: leave
zone: zone.jcb
entity_id: person.duc
actions:
- action: script.text_notify
data:
who: duc
title: '*Notification*'
message: Duc has left work.
- action: input_boolean.turn_on
entity_id: input_boolean.duc_travel_monitor
- action: script.status_annc
data:
who: '{{ states(''sensor.room_audio'') }}'
call_interuption: 1
call_duc_location: 1
- alias: Shion Home Notification
initial_state: true
triggers:
- trigger: state
entity_id: person.shion
to: home
conditions:
- condition: template
value_template: '{{ is_state(''calendar.shion_school'', ''on'') }}'
- condition: template
value_template: '{{ is_state(''sensor.school_event'', ''Home School'') }}'
actions:
- action: script.text_notify
data:
who: duc
title: '*Notification*'
message: Shion is home from school.
- alias: night light on
triggers:
- trigger: time
at: '23:00:00'
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: light.turn_on
entity_id: light.ntl_1
data:
brightness: 40
- alias: night light off
triggers:
- trigger: state
entity_id: sensor.period_of_the_day
to: dawnlight
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ not is_state(''light.ntl_1'', ''off'') }}'
actions:
- action: script.returntonormal
data:
entity: light.ntl_1
- alias: set school pickup time
triggers:
- trigger: state
entity_id: calendar.shion_school
from: 'off'
to: 'on'
actions:
- action: input_datetime.set_datetime
entity_id: input_datetime.school_day_end_reminder
data:
time: "{% if state_attr('calendar.shion_school', 'description' ) == 'early-release'\
\ %}\n 12:45\n{% else %}\n 16:30\n{% endif %}\n"
- alias: school time notification
triggers:
- trigger: time
at: 07:19:00
conditions:
- condition: template
value_template: '{{ is_state(''binary_sensor.desktop_status'', ''on'') }}'
- condition: template
value_template: '{{ is_state(''input_boolean.school_today'', ''on'') }}'
actions:
- action: script.text_notify_image
data:
who: desktop
title: School Time
message: Time for Shion to go to school.
image: http://homeassistant.local:8123/local/img/misc/school-bell.png
- alias: Vehicles Arriving Notification
triggers:
- trigger: state
entity_id: sensor.units_arriving
to: 'on'
conditions:
- condition: template
value_template: '{{ states(''sensor.units_arriving'') = ''unknown'' }}'
actions:
- action: script.text_notify
data:
who: discord_eta
message: '{% set today = as_timestamp(now() + timedelta(days = 12))|timestamp_custom(''%-m/%d/%Y'',
true ) %}
**Today is {{ now().strftime( ''%B %d, %Y'') }}**
List of Containers | Roro Arriving on {{ today }}.
Please make arrangements to have BL docs send to customers.
---
{{ state_attr(''sensor.units_arriving'', ''description'') }}
'
- alias: Vehicle Delivery Notifications
initial_state: true
triggers:
- trigger: state
entity_id:
- sensor.deliveryin2week
conditions:
- condition: template
value_template: '{{ states(''sensor.deliveryin2week'') = ''unknown'' }}'
- condition: template
value_template: '{{ states(''sensor.deliveryin2week'')| trim = '''' }}'
actions:
- action: script.email_notify
data:
who: jcb
title: 'Vehicle Delivery Notification: ETA {{ as_timestamp(now() + timedelta(days
= 11))|timestamp_custom(''%-m/%d/%Y'', true ) }}'
message: '{% set today = as_timestamp(now() + timedelta(days = 12))|timestamp_custom(''%-m/%d/%Y'',
true ) %}
<b>Today is {{ now().strftime( ''%B %d, %Y'') }} </b> <br> <br> <b> List of
Containers / Roro Arriving on {{ today }}.</b> <br> {% if is_state(''sensor.deliveryin2week'',
'''') %} There are no vehicles. {% else %} The following units are arriving
in about 10 days. Please make arrangements to have BL send to customers.<br><br>
{{ states(''sensor.deliveryin2week'') }} {% endif %} <br> <br>
'
- alias: Holiday Notification
initial_state: true
triggers:
- trigger: state
entity_id: sensor.holiday
conditions:
- condition: template
value_template: '{{ states(''sensor.holiday'') = ''unknown'' }}'
- condition: template
value_template: '{{ states(''sensor.holiday'')| trim = ''none'' }}'
actions:
- action: script.text_notify
data:
who: duc
title: '{{ states(''sensor.holiday'') }}'
message: Today is {{ states('sensor.holiday') }}.
- alias: Payday Notification
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.payday
to: 'on'
conditions: []
actions:
- action: script.text_notify
data:
who: viber
title: Payday
message: "{{ [\n \"You've got paid.\",\n \"Fund's in the bank.\",\n \"A deposit\
\ has been issued.\",\n \"It's payday.\"\n ] | random }}"
- alias: Backup HA Notifications
triggers:
- trigger: state
entity_id: sensor.samba_backup
conditions:
- condition: not
conditions:
- condition: state
entity_id: sensor.samba_backup
state: IDLE
actions:
- action: script.text_notify
data:
who: duc
title: '*Information*'
message: Samba backup {{ states('sensor.samba_backup')| lower }}.
- action: logbook.log
data:
name: Samba Backup
message: '{{ states(''sensor.samba_backup'')| lower }}'
- alias: VJ SSL Certificate Expiry Notification
initial_state: true
triggers:
- trigger: numeric_state
entity_id: sensor.vj_ssl_cert_expiry
below: 3
actions:
- action: script.email_notify
data:
who: duc
title: 'Certificate Expiring in {{ states(''sensor.vj_ssl_cert_expiry'') }}
Days: {{ states.sensor.vj_cert_sslmate.attributes.dns_names[0] }}'
message: '{% set str = states.sensor.vj_cert_sslmate.attributes.issuer.name
%} {% set issuer = (str|regex_findall_index(''[a-zA-Z]{8}'')).replace('''','''')
%} <b>Today is {{ now().strftime( ''%B %d, %Y'') }} </b> <br> <br> This is
to notify you that your certificate with the common name {{ states.sensor.vj_cert_sslmate.attributes.dns_names[0]
}} will expire in {{ states.sensor.vj_ssl_cert_expiry.state }} days. <br>
To renew your certificate, please visit <a href="https://my.{{ issuer|lower
}}.com/en/user/">{{ issuer }}</a>.<br> <br>'
- alias: HA SSL Certificate Expiry Notification
initial_state: true
variables:
cn: '{% set str=states(''sensor.ha_ssl_cert_cn'') %} {% set cn=(str|regex_findall_index(''[a-zA-Z]{2,}?\.[a-zA-Z]{1,}'',1))
%} {{ cn }}'
triggers:
- trigger: numeric_state
entity_id: sensor.ha_ssl_cert_expiry
below: 3
actions:
- action: script.email_notify
data:
who: duc
title: 'Certificate Expiring in {{ states(''sensor.ha_ssl_cert_expiry'') }}
Days: {{cn}}'
message: <b>Today is {{ now().strftime( '%B %d, %Y') }} </b> <br> <br> This
is to notify you that your certificate with the common name {{cn}} will expire
in {{ states('sensor.ha_ssl_cert_expiry') }} days. <br> <br>
- alias: Mqtt SSL Certificate Expiry Notification
initial_state: true
variables:
cn: '{% set str=states(''sensor.mqtt_ssl_cert_cn'') %} {% set cn=(str|regex_findall_index(''[a-zA-Z]{2,}'',7))
%} {{ cn }}'
triggers:
- trigger: numeric_state
entity_id: sensor.mqtt_ssl_cert_expiry
below: 3
actions:
- action: script.email_notify
data:
who: duc
title: 'Certificate Expiring in {{ states(''sensor.mqtt_ssl_cert_expiry'') }}
Days: {{ cn }}'
message: <b>Today is {{ now().strftime( '%B %d, %Y') }} </b> <br> <br> This
is to notify you that your certificate with the common name {{cn}} will expire
in {{ states('sensor.mqtt_ssl_cert_expiry') }} days. <br> <br>
- alias: Earthquake Alert
initial_state: true
triggers:
- trigger: state
entity_id:
- sensor.earthquake_alert
conditions:
- condition: template
value_template: '{{ states(''sensor.earthquake_alert'') = ''unknown'' }}'
- condition: template
value_template: '{{ states(''sensor.earthquake_alert'')| trim = '''' }}'
actions:
- action: notify.send_message
target:
entity_id: notify.earthquake_log
data:
message: '{{ state_attr(''sensor.earthquake_alert'', ''at'') }},{{ state_attr(''sensor.earthquake_alert'',
''en_anm'') }},{{ state_attr(''sensor.earthquake_alert'', ''mag'') }},{{ state_attr(''sensor.earthquake_alert'',
''maxi'') }}'
- condition: template
value_template: '{{ state_attr(''sensor.earthquake_alert'', ''mag'')| float(0)
>= 4 }}'
- action: script.update_earthquake_daily_count
- action: script.text_notify
data:
who: duc
title: "{% set d=state_attr('sensor.earthquake_alert', 'at') %} {% set date=(d|regex_findall_index('[0-9]{4}-[0-9]{2}-[0-9]{2}',0)).replace('','')\
\ %} {% set time=(d|regex_findall_index('[0-9]{2}:[0-9]{2}',0)).replace('','')\
\ %}\n Earthquake at {{ time }}"
message: 'Location: {{ state_attr(''sensor.earthquake_alert'', ''en_anm'') }}
M{{ state_attr(''sensor.earthquake_alert'', ''mag'') }}'
- alias: Earthquake Status Notification
triggers:
- trigger: state
entity_id: sensor.seismoM5p_state
from: LISTENING
to: EARTHQUAKE
- trigger: state
entity_id: sensor.seismoM5p_state
from: unavailable
to: LISTENING
id: status
- trigger: state
entity_id: sensor.seismoM5p_state
from: CALIBRATION
to: LISTENING
id: status
- trigger: state
entity_id: sensor.seismoM5p_state
to: unavailable
id: status
- trigger: numeric_state
entity_id: sensor.seismom5p_pga
below: 0.1
for: 60
id: offline
actions:
choose:
- conditions:
- condition: trigger
id: status
sequence:
- action: script.text_notify
data:
who: duc
message: SeismoM5P is {{ states('sensor.seismoM5p_state')| lower() }}...
- conditions:
- condition: trigger
id: offline
sequence:
- action: script.text_notify
data:
who: duc
message: Seismom sensors are offline
default:
- action: script.text_notify
data:
who: duc
message: 'Earthquake Happening at Home '
- alias: Home Air Quality Warnings
variables:
warn_msg: The {{ trigger.to_state.attributes.friendly_name }} in the house is
at {{ trigger.to_state.state }}{{ trigger.to_state.attributes.unit_of_measurement
}}. Take precautionary action.
triggers:
- trigger: numeric_state
entity_id: sensor.ikea_pm25
above: 999
for: 61
- trigger: numeric_state
entity_id: sensor.carbon_monoxide
above: 59
for: 61
- trigger: numeric_state
entity_id: sensor.carbon_dioxide
above: 2000
for: 61
actions:
- action: script.text_notify
data:
who: amber
title: Air Quality Warning
message: '{{ warn_msg }}'
- action: script.text_notify
data:
who: desktop
title: Air Quality Warning
message: '{{ warn_msg }}'
- action: logbook.log
data:
name: '{{ trigger.to_state.attributes.friendly_name }} Warning'
message: '{{ warn_msg }}'
- alias: Central Night Cooling Notification
triggers:
- trigger: state
entity_id:
- binary_sensor.central_night_cooling
to: 'on'
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- action: script.text_notify
data:
who: duc
title: Night Cooling possible
message: Open Windows to cool down the rooms
mode: single
- alias: Washing Machine Water Detection Notification
triggers:
- trigger: state
entity_id:
- binary_sensor.washer_water_leak
to: 'on'
actions:
- action: script.text_notify
data:
who: duc
title: Water Leak Detected
message: Water Detected around the washing machine area.
- action: script.text_notify
data:
who: viber
title: Water Leak Detected
message: Water Detected around the washing machine area.
- action: script.email_notify
data:
who: duc
title: Water Leak Detected
message: <b>Today is {{ now().strftime( '%B %d, %Y') }} </b> <br> <br> There
may have been a water leak around the washing machine area. Action is require
as soon as possible. <br> <br>
mode: single
- alias: Security Report
initial_state: true
triggers:
- trigger: time
at: '21:01:00'
actions:
- action: script.speech_engine
data:
who: '{{ states(''sensor.room_presence'') }}'
message: include ../tpl/speech/security_report.yaml
voice: '{{ states(''input_select.jarvis_voice'') }}'
- alias: Notify Chore Task Due
variables:
entities: group.chore_tasks
triggers:
- trigger: time
at: '16:57:00'
actions:
- repeat:
count: '{{ expand(entities) | list | count }}'
sequence:
- variables:
entity_id: '{% set tasks = expand(entities) | map(attribute=''entity_id'')
| list %} {{ tasks[repeat.index - 1] }}
'
task_id: '{{ entity_id.split(''.'')[1] }}'
last_done_days: '{{ ((as_timestamp(now()) - (as_timestamp(states(entity_id)))
| float) / 60 / 60 / 24) | int }}'
cycle_days: '{{ state_attr(entity_id, ''cycle_days'') | int }}'
warn_before_days: '{{ state_attr(entity_id, ''warning_before'') | int }}'
- condition: template
value_template: '{{ last_done_days|int >= (cycle_days|int - warn_before_days|int)
}}'
- action: script.text_notify
data:
who: duc
title: 🧹 {{ state_attr(entity_id, 'friendly_name') }}
message: 'Chore last done {{ last_done_days }} days ago.
'
- triggers:
- trigger: state
entity_id: media_player.razer_leviathan_player
to: idle
- trigger: state
entity_id: input_boolean.continuous_play
actions:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.continuous_play
state: 'on'
sequence:
- action: script.play_random_track
default:
- action: media_player.media_stop
entity_id: media_player.razer_leviathan_player
- alias: Toggle Balcony Light
triggers:
- entity_id: binary_sensor.lr_window_button
trigger: state
to: 'on'
actions:
- action: switch.toggle
entity_id: switch.balcony_light
- alias: Charge Balcony Camera
triggers:
- platform: numeric_state
entity_id: sensor.balcony_battery_percentage
below: 25
- platform: numeric_state
entity_id: sensor.balcony_battery_percentage
above: 95
conditions: []
actions:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.balcony_battery_percentage
below: 25
sequence:
- action: switch.turn_on
entity_id: switch.usb_relay_adapter1_relay
- action: script.text_notify
data:
who: duc
title: Balcony Cam Batt Low
message: Balcony camera battery is currently charging.
- conditions:
- condition: numeric_state
entity_id: sensor.balcony_battery_percentage
above: 95
sequence:
- action: switch.turn_off
entity_id: switch.usb_relay_adapter1_relay
- action: script.text_notify
data:
who: duc
title: Balcony Cam Batt Charged
message: Balcony camera battery has completed charging.
default: []
- alias: Capture Image on Trigger, Send Mobile Notification with Actions, Snooze or
Alarm via Actions
trigger:
- platform: state
entity_id:
- image.balcony_event_image
id: sensor
- platform: event
event_type: mobile_app_notification_action
id: snooze
event_data:
action: SNOOZE
- platform: event
event_type: mobile_app_notification_action
id: alarm
event_data:
action: ALARM
conditions:
- condition: template
value_template: '{{ as_timestamp(states.image.balcony_event_image.last_changed)
== as_timestamp(states.image.balcony_event_image.last_updated) }}'
- condition: template
value_template: '{{ not is_state(''input_select.home_mode'', ''Home'') }}'
actions:
- choose:
- conditions:
- condition: trigger
id: sensor
sequence:
- delay: 3
- action: notify.mobile_app_id
data:
message: Motion detected - Balcony
data:
image: /api/image_proxy/image.balcony_event_image
actions:
- action: ALARM
title: Alarm
- action: SNOOZE
title: Snooze
- conditions:
- condition: trigger
id: snooze
sequence:
- action: eufy_security.snooze
data:
snooze_time: 10
snooze_chime: false
snooze_motion: true
snooze_homebase: false
target:
entity_id: camera.balcony
- conditions:
- condition: trigger
id: alarm
sequence:
- action: eufy_security.trigger_camera_alarm_with_duration
data:
duration: 1
target:
entity_id: camera.balcony
mode: single
- id: sentry_mode_enabled
alias: Sentry Mode Enabled Annoucement
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.sentry_mode
from: 'off'
to: 'on'
actions:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.genkan_door_contact
state: 'on'
sequence:
- action: input_boolean.turn_off
entity_id: input_boolean.sentry_mode
- action: input_boolean.turn_on
entity_id: input_boolean.lockdown_issue
- action: script.text_notify
data:
who: duc
message: '{{ [ "I was unable to activate genkan door protocol due to an
open door.", "You may want to check the external doors. I was unable to
secure them all.", "My systems check has failed. Please check the external
doors.", "Someone has left the front door open." ] | random }}
'
- action: script.sentry_mode_status
data:
modus: pending
default:
- action: script.speech_engine
data:
who: '{{ states(''sensor.room_audio'') }}'
voice: '{{ states(''input_select.jarvis_voice'') }}'
message: '{{ [ "Lions door protocol has been activated.", "Lions Home has
been secured ", "Sentry Mode is active. ", "I am now monitoring the doors
and will let you know if anyone attempts to access.", "Lions Home Shields
are up." ] | random }}
'
- action: script.text_notify
data:
who: duc
title: Security Armed
message: Security System has been armed.
- action: input_boolean.turn_on
entity_id: input_boolean.security_cameras
- action: script.turn_on
entity_id: script.reset_front_door_motion_count
- action: script.sentry_mode_status
data:
modus: '{% set night = (now() - state_attr(''automation.nightly_lockdown'',
''last_triggered'')).seconds %}
{% if is_state(''input_boolean.vacation_mode'', ''on'') %} armed_vacation
{%elif night <= 2 %} armed_night
{% else %} armed_away {% endif %}
'
- id: nightly_lockdown
alias: Nightly Lockdown
triggers:
- trigger: time
at: '23:00:00'
conditions:
- condition: state
entity_id: person.duc
state: home
- condition: state
entity_id: person.eri
state: home
- condition: template
value_template: '{{ is_state(''input_boolean.guest_mode'', ''off'') }}'
- condition: state
entity_id: input_boolean.sentry_mode
state: 'off'
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.sentry_mode
- id: motion_detected_front_door
alias: Motion Detected Front Door
triggers:
- trigger: state
entity_id: binary_sensor.genkan_door_contact
from: 'off'
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.sentry_mode
state: 'on'
actions:
- delay: 2
- choose:
- conditions:
- condition: template
value_template: '{{ is_state(''binary_sensor.genkan_moving_target'', ''on'')
}}'
sequence:
- action: mqtt.publish
data:
topic: house/alerts/front_door_motion/away_count
payload: '{{ states(''sensor.front_door_motion_away_count'') | int(0) +
1 }}'
retain: true
- action: script.status_annc
data:
who: '{{ states(''sensor.room_presence'') }}'
call_interuption: 1
call_snark_door_motion: 1
speech_message: '{% set alias = {"Genkan Moving Target":"front door"} %}
{% set l = trigger.to_state.attributes.friendly_name %} {% set location
= alias.get(l) %} {{ [ "I have detected someone at the ", "Someone appears
to be at the ", "There is a person at the ", "My sensors are picking up
presence at the ", "We appear to have a visitor at the ", "My sensors
have detected a meat popsicle at the " ] | random }} {{ location }}.
'
- action: script.sentry_mode_status
data:
modus: triggered
- delay:
minutes: 2
initial_state: true
- id: security_breach
alias: Security Breach
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.genkan_door_contact
- binary_sensor.computerroom_window
- binary_sensor.livingroom_window
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.sentry_mode
state: 'on'
actions:
- action: script.alexa_alert
data:
message: My security protocols are being overidden, The {{ trigger.to_state.attributes.friendly_name
}} has been opened.
- action: script.text_alert
data:
who: duc
title: Security Alert
message: '{{ trigger.to_state.attributes.friendly_name }} has been opened.'
- action: input_boolean.turn_on
entity_id: input_boolean.security_issue
- action: script.sentry_mode_status
data:
modus: triggered
- id: sentry_mode_disabled
alias: Sentry Mode Disabled Annoucement
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.sentry_mode
from: 'on'
to: 'off'
actions:
- choose:
- conditions:
condition: or
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Returning'')
}}'
- condition: template
value_template: '{{ is_state(''input_boolean.guest_mode'', ''on'') }}'
sequence:
- action: script.speech_engine
data:
who: '{{ states(''sensor.room_audio'') }}'
voice: '{{ states(''input_select.jarvis_voice'') }}'
message: '{{ [ "Lions door protocol has been deactivated.", "I am no longer
monitoring the access points. ", "Sentry Mode has been disabled. ", "Lions
Home Shields are down." ] | random }}
'
- action: script.text_notify
data:
who: duc
title: Welcome Home
message: Security System has been disarmed.
- action: input_boolean.turn_off
entity_id: input_boolean.security_alarm
- action: script.sentry_mode_status
data:
modus: disarmed
default:
- action: input_boolean.turn_off
entity_id: input_boolean.sentry_mode
- action: script.text_notify
data:
who: duc
title: Potential Security Issue
message: Security System has been disarmed, but I could not validate presence.
- action: script.sentry_mode_status
data:
modus: pending
- id: morning_standby
alias: Morning Standby
initial_state: true
triggers:
- trigger: time
at: 04:10:00
condition:
condition: or
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ is_state(''input_boolean.guest_mode'', ''on'') }}'
actions:
- action: script.standby
- id: enable_vacation_mode
alias: Enable Vacation Mode
initial_state: true
triggers:
- trigger: numeric_state
entity_id: sensor.duc_ett_home
above: 180
- trigger: numeric_state
entity_id: sensor.eri_ett_home
above: 180
conditions:
- condition: numeric_state
entity_id: sensor.duc_ett_home
above: 180
- condition: numeric_state
entity_id: sensor.eri_ett_home
above: 180
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.vacation_mode
- id: guest_mode_feedback
alias: Guest Mode Audio Feedback
triggers:
- trigger: state
entity_id:
- input_boolean.guest_mode
from: 'off'
to: 'on'
actions:
- action: script.speech_engine
data:
who: '{{ states(''sensor.room_audio'') }}'
voice: '{{ states(''input_select.jarvis_voice'') }}'
message: '{{ [ "Guest Mode has been enabled.", "I have switched to the system
to guest mode.", "I have enabled guest mode. ", "Guest Mode is on." ] | random
}}
'
- id: security_response_on
alias: Security Response On
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.security_issue
from: 'off'
to: 'on'
for: 00:02:00
actions:
- action: script.turn_on
entity_id: script.security_response
- action: script.alarm_light_flash
- alias: Weather - Set Daily Maximum Forecasted Temperature
trigger:
- platform: time
at: '14:00:00'
condition: []
action:
- service: input_number.set_value
data:
value: '{{ state_attr(''sensor.my_weather_forecast_daily'', ''weather_forecast_max_temp_today'')
}}'
target:
entity_id: input_number.weather_forecast_max_temp_today
mode: single
- alias: Forecast Low Near Freezing
triggers:
- trigger: numeric_state
entity_id: sensor.wbio_overnight_low
below: 1.6
- trigger: numeric_state
entity_id: sensor.wbio_current_temperature
below: 1.6
conditions:
- condition: state
entity_id: input_boolean.freeze_warning
state: 'off'
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.freeze_warning
- alias: Forecast Low Above Freezing
triggers:
- trigger: numeric_state
entity_id: sensor.wbio_overnight_low
above: 0.5
conditions:
- condition: state
entity_id: input_boolean.freeze_warning
state: 'on'
- condition: numeric_state
entity_id: sensor.wbio_overnight_low
above: 1.6
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.freeze_warning
- alias: Rain Detected Home
triggers:
- trigger: state
entity_id: sensor.rainfall_today
from: '0.0'
actions:
- action: script.text_notify
data:
who: duc
message: It's currently raining at home.
- action: script.status_annc
data:
who: ai_4
voice: '{{ states(''input_select.jarvis_voice'') }}'
call_interuption: 1
speech_message: Rain has been detected at home.
- alias: Status light update (bulbs)
triggers:
- trigger: state
entity_id: sensor.light_status
condition: []
actions:
- action: light.turn_off
target:
entity_id: light.{{ states('sensor.light_status') }}
- alias: Presence Duc On
triggers:
- trigger: numeric_state
entity_id: sensor.id_presence
above: 10
- trigger: template
value_template: '{{ states(''sensor.duc_bermuda_area'').lower() in [''computer'',
''shionroom'', ''kitchen'', ''masterroom'', ''living'', ''genkan''] }}'
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.duc_presence
- alias: Presence Duc Off
mode: restart
triggers:
- trigger: numeric_state
entity_id: sensor.id_presence
below: 10
- trigger: state
entity_id: sensor.duc_bermuda_area
to: unknown
conditions:
- condition: template
value_template: '{{ states(''sensor.id_presence'')| float(0) == 0.0 }}'
- condition: template
value_template: '{{ is_state(''sensor.duc_bermuda_area'', ''unknown'') }}'
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.duc_presence
- alias: Presence Eri On
triggers:
- trigger: numeric_state
entity_id: sensor.ie_presence
above: 10
- trigger: template
value_template: '{{ states(''sensor.eri_bermuda_area'').lower() in [''computer'',
''shionroom'', ''kitchen'', ''masterroom'', ''living'', ''genkan''] }}'
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.eri_presence
- alias: Presence Eri Off
mode: restart
triggers:
- trigger: numeric_state
entity_id: sensor.ie_presence
below: 10
- trigger: state
entity_id: sensor.eri_bermuda_area
to: unknown
conditions:
- condition: template
value_template: '{{ states(''sensor.ie_presence'')| float(0) == 0.0 }}'
- condition: template
value_template: '{{ is_state(''sensor.eri_bermuda_area'', ''unknown'') }}'
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.eri_presence
- alias: Presence Shion On
triggers:
- trigger: numeric_state
entity_id: sensor.tms_presence
above: 10
- trigger: template
value_template: '{{ states(''sensor.shion_tms_bermuda_area'').lower() in [''computer'',
''shionroom'', ''kitchen'', ''masterroom'', ''living'', ''genkan''] }}'
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.shion_presence
- alias: Presence Shion Off
triggers:
- trigger: numeric_state
entity_id: sensor.tms_presence
below: 10
- trigger: state
entity_id: sensor.shion_tms_bermuda_area
to: unknown
conditions:
- condition: template
value_template: '{{ is_state(''sensor.shion_tms_bermuda_area'', ''unknown'') }}'
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.shion_presence
- alias: Presence Sachiko On
triggers:
- trigger: numeric_state
entity_id: sensor.sachiko_presence
above: 10
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.sachiko_presence, input_boolean.toggle_guest_presence
- alias: Presence Sachiko Off
triggers:
- trigger: numeric_state
entity_id: sensor.sachiko_presence
below: 10
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.sachiko_presence
- alias: Presence Tomokun On
triggers:
- trigger: numeric_state
entity_id: sensor.tomokun_presence
above: 10
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.tomokun_presence, input_boolean.toggle_guest_presence
- alias: Presence Tomokun Off
triggers:
- trigger: numeric_state
entity_id: sensor.tomokun_presence
below: 10
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.tomokun_presence
- alias: Enable Guest Mode
triggers:
- trigger: state
entity_id: group.guest_presence
to: 'on'
actions:
- action: homeassistant.turn_on
entity_id: input_boolean.guest_mode
- action: notify.mobile_app_id
data:
message: Guest Mode is turned {{ states('input_boolean.guest_mode') }}.
title: '*Guest Mode Status*'
- alias: Disable Guest Mode
triggers:
- trigger: state
entity_id: group.guest_presence
to: 'off'
actions:
- action: homeassistant.turn_off
entity_id: input_boolean.guest_mode
- action: notify.mobile_app_id
data:
message: Guest Mode is turned {{ states('input_boolean.guest_mode') }}.
title: '*Guest Mode Status*'
- alias: Monentary Presence Monitor Trigger
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.genkan_moving_target
to: 'on'
actions:
- delay: 4
- action: switch.turn_on
data:
entity_id: switch.momentary_presence_monitor
- alias: Presence Scan Arrival
triggers:
- trigger: state
entity_id: binary_sensor.aio_human_sensor_entrance_moving_target
to: 'on'
conditions:
- condition: template
value_template: '{{ is_state(''switch.momentary_presence_monitor'', ''off'') }}'
actions:
- action: mqtt.publish
data:
topic: monitor/scan/arrive
- alias: Presence Scan Departure
triggers:
- trigger: state
entity_id: binary_sensor.genkan_door_contact
to: 'on'
conditions:
- condition: template
value_template: '{{ is_state(''switch.momentary_presence_monitor'', ''on'') }}'
actions:
- delay: 00:01:25
- action: script.monitor_depart
- alias: Presence Restart Daily
initial_state: 'on'
triggers:
- trigger: time
at: 04:01:00
actions:
- action: mqtt.publish
data:
topic: monitor/scan/restart
payload: ''
- alias: Home Mode - Arriving
triggers:
- trigger: state
entity_id: sensor.n_people_home
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.vacation_mode'', ''on'') }}'
- condition: template
value_template: '{{ trigger.to_state.state|int(0) > trigger.from_state.state|int(0)
}}
'
actions:
- action: input_select.select_option
entity_id: input_select.home_mode
data:
option: Home
- action: script.standby
- action: select.select_option
target:
entity_id: select.balcony_guard_mode
data:
option: Home
- alias: Home Mode - Leaving
triggers:
- trigger: numeric_state
entity_id: sensor.n_people_home
below: 1
for: 10
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.vacation_mode'', ''on'') }}'
- condition: state
entity_id: input_select.home_mode
state: Home
actions:
- action: input_select.select_option
entity_id: input_select.home_mode
data:
option: Away
- action: script.appliances_off
- action: script.text_notify
data:
who: duc
message: There are {{ states('sensor.n_people_home') }} people at home now.
title: '*Home Status*'
- action: input_boolean.turn_on
entity_id: input_boolean.sentry_mode
- action: select.select_option
target:
entity_id: select.balcony_guard_mode
data:
option: Away
- alias: Home Mode - Vacation
triggers:
- trigger: state
entity_id: input_boolean.vacation_mode
actions:
choose:
- conditions: '{{ states.input_boolean.vacation_mode.state == ''on'' }}
'
sequence:
- action: input_select.select_option
entity_id: input_select.home_mode
data:
option: Vacation
- action: input_boolean.turn_on
entity_id: input_boolean.sentry_mode
- conditions: "{{ states.input_boolean.vacation_mode.state == 'off' and\n states.sensor.n_people_home.state\
\ | int(0) < 1 }}\n"
sequence:
- action: input_select.select_option
entity_id: input_select.home_mode
data:
option: Away
- conditions: "{{ states.input_boolean.vacation_mode.state == 'off' and\n states.sensor.n_people_home.state\
\ | int(0) >= 1 }}\n"
sequence:
- action: input_select.select_option
entity_id: input_select.home_mode
data:
option: Home
- action: script.standby
- alias: Set tms Tile Location
triggers:
- trigger: state
entity_id: input_boolean.shion_presence
actions:
- service_template: script.set_device_tracker_shion
- alias: Set Location Waze
triggers:
- trigger: numeric_state
entity_id: sensor.duc_to_work_waze, sensor.eri_to_work_waze
below: 3
actions:
choose:
- conditions: '{{ trigger.to_state.attributes.friendly_name == ''duc to work waze''
}}'
sequence:
- action: device_tracker.see
data:
dev_id: duc
location_name: Duc Work
- conditions: '{{ trigger.to_state.attributes.friendly_name == ''eri to work waze''
}}'
sequence:
- action: device_tracker.see
data:
dev_id: eri
location_name: Eri Work
- id: family_has_arrived
alias: Family Has arrived
triggers:
- trigger: zone
entity_id: person.duc
zone: zone.home
event: enter
id: duc
- trigger: zone
entity_id: person.eri
zone: zone.home
event: enter
id: eri
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id: duc
sequence:
- action: input_boolean.turn_off
data: {}
entity_id: input_boolean.duc_travel_monitor
- conditions:
- condition: trigger
id: eri
sequence:
- action: input_boolean.turn_off
data: {}
entity_id: input_boolean.eri_travel_monitor
default: []
- alias: QLM Climate Change
triggers:
- trigger: state
entity_id:
- input_select.lr_ac_mode
- input_select.mr_ac_mode
- input_select.sr_ac_mode
actions:
- action: climate.set_hvac_mode
target:
entity_id: climate.{{ trigger.entity_id.split('.')[1] }}
data:
hvac_mode: "{% set hvac_modes = {\n 'Off': 'off',\n 'Fan': 'fan_only',\n \
\ 'Ai Auto': 'auto',\n 'Man Auto': 'auto',\n 'Powerful Cool': 'cool',\n\
\ 'Normal Cool': 'cool',\n 'Silent Cool': 'cool',\n 'Manual Cool': 'cool',\n\
\ 'Powerful Heat': 'heat',\n 'Normal Heat': 'heat',\n 'Silent Heat': 'heat',\n\
\ 'Manual Heat': 'heat',\n 'Normal Humidifier': 'fan_only'\n} %} {{ hvac_modes[states(trigger.entity_id)]\
\ }}\n"
- alias: School today
initial_state: true
triggers:
- trigger: time
at: 05:00:00
conditions:
- condition: and
conditions:
- condition: template
value_template: "{%- if as_timestamp(strptime(state_attr('calendar.shion_school',\
\ 'start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom(\"%Y-%m-%d\") ==\
\ now().strftime(\"%Y-%m-%d\") %}\n true\n{%- endif -%}\n"
- condition: template
value_template: '{{ states(''sensor.holiday'') == ''none'' }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ ''home school'' in states(''sensor.school_event'') }}
'
sequence:
- action: input_boolean.turn_on
entity_id: input_boolen.school_early_release
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.school_day_end
data:
time: '15:15:00'
default:
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.school_day_end
data:
time: '18:15:00'
- action: input_boolean.turn_on
entity_id: input_boolean.school_today
- action: script.turn_on
entity_id: script.school_in_session
- alias: Shion Night Briefing
triggers:
- trigger: time
at: input_datetime.shion_school_bedtime
id: school_night
- trigger: time
at: input_datetime.shion_bedtime_holiday
id: no_school
conditions:
- condition: state
entity_id: input_boolean.shion_awake
state: 'on'
actions:
- choose:
- conditions:
- condition: state
entity_id: sensor.school_tomorrow
state: 'on'
- condition: trigger
id: school_night
sequence:
- action: script.turn_on
target:
entity_id: script.shion_nightly_briefing
- conditions:
- condition: state
entity_id: sensor.school_tomorrow
state: 'off'
- condition: trigger
id: no_school
sequence:
- action: script.turn_on
target:
entity_id: script.shion_nightly_briefing
default: []
- alias: set shion nightly bedtime time
triggers:
- trigger: time
at: '18:30:00'
actions:
- action: input_datetime.set_datetime
entity_id: input_datetime.shion_nightly_report
data:
time: "{% if is_state('sensor.school_tomorrow', 'on') or is_state('sensor.school_event',\
\ 'school off') %}\n 21:00\n{% else %}\n 21:30\n{% endif %}\n"
- alias: Randomize Vacation Lights
triggers:
- trigger: state
entity_id: input_boolean.randomize_vacation_lights
conditions:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
actions:
- service_template: "{% if is_state('input_boolean.randomize_vacation_lights', 'on'\
\ )%} script.turn_on {% else %}\n script.turn_off\n{% endif %}\n"
data:
entity_id: script.randomize_vacation_lights
- alias: Run Vacation Lights
triggers:
- trigger: sun
event: sunset
id: sundown
- trigger: sun
event: sunrise
id: sunup
- trigger: state
entity_id: input_boolean.vacation_mode
id: cancel
from: 'on'
to: 'off'
actions:
- choose:
- conditions:
- condition: trigger
id: sundown
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
sequence:
- action: input_boolean.turn_on
entity_id: input_boolean.randomize_vacation_lights
- conditions:
- condition: or
conditions:
- condition: trigger
id: sunup
- condition: trigger
id: cancel
sequence:
- action: input_boolean.turn_off
entity_id: input_boolean.randomize_vacation_lights
- alias: Daily Energy Use Message
triggers:
- trigger: time
at: '23:59:50'
actions:
- action: notify.notify_events
data:
title: '*Information*'
message: Today's energy use was {{ states('sensor.total_energy') }} kWh.
- action: input_number.set_value
data:
entity_id: input_number.cumulative_energy_cost
value: '{{ states(''input_number.cumulative_energy_cost'')|float(0) + states(''sensor.total_cost_today'')|float(0)
}}'
- action: notify.send_message
target:
entity_id: notify.energy_log
data:
message: '{{ states(''sensor.date'') }},{{ states(''sensor.energy_t31_light_and_power_day'')
}},{{ states(''sensor.energy_t31_light_and_power_night'') }},{{ states(''sensor.energy_t31_light_and_power_total'')
}},{{ states(''sensor.energy_t41_heating_day'') }},{{ states(''sensor.energy_t41_heating_night'')
}},{{ states(''sensor.energy_t41_heating_total'') }},{{ states(''sensor.total_energy_day'')
}},{{ states(''sensor.total_energy_night'') }},{{ states(''sensor.total_energy'')
}},{{ state_attr(''sensor.power_stats'',''age_coverage_ratio'') }},{{ state_attr(''sensor.power_stats'',''buffer_usage_ratio'')
}},{{ states(''sensor.power_stats'') }},{{ states(''sensor.total_cost_today'')
}}'
- alias: Monthly Fridge Energy Use Message
triggers:
- trigger: time
at: '23:59:55'
conditions:
- condition: template
value_template: '{{ now().day == 1 }}'
actions:
- action: notify.send_message
target:
entity_id: notify.fridge_log
data:
message: '{{ states(''sensor.date'') }},{{ states(''sensor.energy_fridge_power_monthly'')
}}'
- alias: Set Dark Theme At Sunset
initial_state: true
triggers:
- trigger: sun
event: sunset
actions:
- action: input_select.select_option
data:
entity_id: input_select.select_theme
option: midnight
- action: select.select_option
target:
entity_id:
- select.energy_t31_light_and_power
- select.energy_t41_heating
data:
option: night
- alias: Set Light Theme At Sunrise
initial_state: true
triggers:
- trigger: sun
event: sunrise
actions:
- action: input_select.select_option
data:
entity_id: input_select.select_theme
option: default_ha
- action: select.select_option
target:
entity_id:
- select.energy_t31_light_and_power
- select.energy_t41_heating
data:
option: day
- alias: Slack - PC is on
triggers:
- trigger: state
entity_id: binary_sensor.duc_presence
to: 'off'
for: 60
conditions:
- condition: template
value_template: '{{ is_state(''binary_sensor.desktop_status'', ''on'') }}'
actions:
- action: script.notify_slack
data:
channel: secret slack_channel_id
message: The PC was left {{ states('binary_sensor.desktop_status') }} and there
are {{ states('sensor.n_people_home') }} person at home.
attachments:
- title: Turn off the PC?
callback_id: turn_off_pc_callback
color: '#03a9f4'
attachment_type: default
actions:
- text: Turn off
value: Turn off
name: script.desktop_wol_off
type: button
- text: Leave it
value: Leave it
name: dismiss
type: button
- alias: 24hr fan toggle on-off
triggers:
- trigger: time
at: 04:00:00
- trigger: time
at: '23:00:00'
conditions:
- condition: template
value_template: '{{ not is_state(''input_select.home_mode'', ''Vacation'') }}'
actions:
- action: switch.turn_{{ 'on' if is_state('sensor.time', '04:00') else 'off' }}
data:
entity_id: switch.24hr_fan
- alias: 24hr fan toggle speed
triggers:
- trigger: time
at: 04:05:00
- trigger: state
entity_id: sensor.period_of_the_day
to: dusklight
conditions:
- condition: template
value_template: '{{ not is_state(''input_select.home_mode'', ''Vacation'') }}'
actions:
- delay: 90
- action: script.holdpress_bot
data:
bot: 24hr_fan
press: 0
- alias: Open Front Curtains at Sunrise
triggers:
- trigger: state
entity_id: sensor.period_of_the_day
to:
- dawnlight
- daylight
conditions:
- condition: template
value_template: '{{ is_state(''input_select.home_mode'', ''Home'') }}'
- condition: template
value_template: '{{ not is_state(''input_select.home_mode'', ''Vacation'') }}'
- condition: template
value_template: '{{ states(''sensor.time'') > ''05:00'' }}'
- condition: template
value_template: '{{ not states(''sensor.eri_bermuda_area'').lower() in [''kitchen'',
''living''] }}'
actions:
- action: cover.set_cover_position
data:
position: '{% if is_state("sensor.period_of_the_day", "dawnlight") %} 50 {%
else %} 100 {% endif %}'
entity_id:
- cover.fr_curtains
- alias: Close Front Curtains at Sunset
triggers:
- trigger: state
entity_id: sensor.period_of_the_day
to:
- dusklight
- nightlight
conditions:
- condition: template
value_template: '{{ states(''sensor.fr_curtains'') = ''closed'' }}'
- condition: template
value_template: '{{ not is_state(''input_select.home_mode'', ''Vacation'') }}'
actions:
- action: cover.set_cover_position
data:
position: '{% if is_state("sensor.period_of_the_day", "dusklight") %} 50 {%
else %} 0 {% endif %}'
entity_id:
- cover.fr_curtains
- alias: Close Computer Room Curtains
triggers:
- trigger: state
entity_id: binary_sensor.cr_window_button
to: 'on'
conditions:
- condition: template
value_template: '{{ is_state(''cover.cr_curtain_lt_curtain'', ''open'') }}'
actions:
- action: script.cr_curtains_toggle
- alias: Telegram - Notification Door Unlocked
triggers:
- trigger: state
entity_id: lock.lock_pro_8d0a
to: unlocked
for: 120
id: msg
- trigger: event
event_type: telegram_callback
event_data:
data: /lock_door
id: lockdoor
conditions:
- condition: template
value_template: '{{ is_state(''lock.lock_pro_8d0a'', ''unlocked'') }}'
actions:
- choose:
- conditions:
- condition: trigger
id: msg
sequence:
- action: notify.amberthebot
data:
message: The {{ trigger.to_state.attributes.friendly_name }} door has been
left {{ states('lock.lock_pro_8d0a') }}.
data:
inline_keyboard:
- Lock Door:/lock_door, Leave it:/donothing
- conditions:
- condition: trigger
id: lockdoor
sequence:
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: OK, locking genkan door now...
- action: telegram_bot.edit_replymarkup
data:
message_id: '{{ trigger.event.data.message.message_id }}'
chat_id: '{{ trigger.event.data.chat_id }}'
inline_keyboard: []
- action: lock.lock
entity_id: lock.lock_pro_8d0a
default: []
- alias: Pre Auto Unlock Door
triggers:
- trigger: state
entity_id: device_tracker.id, device_tracker.ie
to: home
conditions: []
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ is_state(''device_tracker.id'', ''home'') }}'
sequence:
- action: input_boolean.turn_on
entity_id: input_boolean.duc_unlock_door
- conditions:
- condition: template
value_template: '{{ is_state(''device_tracker.ie'', ''home'') }}'
sequence:
- action: input_boolean.turn_on
entity_id: input_boolean.eri_unlock_door
- alias: Telegram - Notification Auto Unlock Door Enabled
triggers:
- trigger: state
entity_id: device_tracker.id, device_tracker.ie
to: home
id: msg
- trigger: event
event_type: telegram_callback
event_data:
data: /disable_autolock
id: disable
conditions:
- condition: template
value_template: '{{ is_state(''input_boolean.duc_unlock_door'', ''on'') or is_state(''input_boolean.eri_unlock_door'',
''on'') }}'
actions:
- choose:
- conditions:
- condition: trigger
id: msg
sequence:
- action: notify.amberthebot
data:
message: Auto doorlock has been initialized by {{ trigger.to_state.attributes.friendly_name
}}.
data:
inline_keyboard:
- Disable Auto Lock:/disable_autolock, Leave it:/donothing
- conditions:
- condition: trigger
id: disable
sequence:
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: OK, disabling auto doorlock now...
- action: telegram_bot.edit_replymarkup
data:
message_id: '{{ trigger.event.data.message.message_id }}'
chat_id: '{{ trigger.event.data.chat_id }}'
inline_keyboard: []
- action: input_boolean.turn_off
data:
entity_id: input_boolean.{{ 'duc' if is_state('input_boolean.duc_unlock_door',
'on') else 'eri' }}_unlock_door
default: []
- alias: Auto Unlock Door
triggers:
- trigger: state
entity_id: binary_sensor.aio_human_sensor_entrance_moving_target, binary_sensor.aio_human_sensor_entrance_presence
from: 'off'
to: 'on'
conditions: []
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ is_state(''input_boolean.duc_unlock_door'', ''on'') and
is_state(''device_tracker.id'', ''home'') }}'
- condition: template
value_template: "{%- set trig = (now() - states.device_tracker.duc_bermuda_bermuda_tracker.last_changed).seconds\
\ -%}\n {{ is_state('device_tracker.duc_bermuda_bermuda_tracker', 'home')\
\ and trig <= 60 }}"
- condition: template
value_template: '{{ is_state(''lock.lock_pro_8d0a'', ''locked'') }}'
sequence:
- action: lock.unlock
entity_id: lock.lock_pro_8d0a
- action: input_boolean.turn_off
entity_id: input_boolean.duc_unlock_door
- conditions:
- condition: template
value_template: '{{ is_state(''input_boolean.eri_unlock_door'', ''on'') and
is_state(''device_tracker.ie'', ''home'') }}'
- condition: template
value_template: "{%- set trig = (now() - states.device_tracker.eri_bermuda_bermuda_tracker.last_changed).seconds\
\ -%}\n {{ is_state('device_tracker.eri_bermuda_bermuda_tracker', 'home')\
\ and trig <= 60 }}"
- condition: template
value_template: '{{ is_state(''lock.lock_pro_8d0a'', ''locked'') }}'
sequence:
- action: lock.unlock
entity_id: lock.lock_pro_8d0a
- action: input_boolean.turn_off
entity_id: input_boolean.eri_unlock_door
- alias: Telegram - Notification PC is on
triggers:
- trigger: state
entity_id: binary_sensor.duc_presence
to: 'off'
for: 60
id: msg
- trigger: event
event_type: telegram_callback
event_data:
data: /turn_off_pc
id: shutdown
conditions:
- condition: template
value_template: '{{ is_state(''binary_sensor.desktop_status'', ''on'') }}'
actions:
- choose:
- conditions:
- condition: trigger
id: msg
sequence:
- action: notify.amberthebot
data:
message: The PC was left {{ states('binary_sensor.desktop_status') }} and
there are {{ states('sensor.n_people_home') }} person at home.
data:
inline_keyboard:
- Turn off pc:/turn_off_pc, Leave it:/donothing
- conditions:
- condition: trigger
id: shutdown
sequence:
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: OK, turning off pc now
- action: telegram_bot.edit_replymarkup
data:
message_id: '{{ trigger.event.data.message.message_id }}'
chat_id: '{{ trigger.event.data.chat_id }}'
inline_keyboard: []
- action: script.desktop_wol_off
default: []
- alias: Telegram - You got mail
triggers:
- trigger: state
entity_id: sensor.lora_mailbox
id: mail
to: '0xA2B2'
for: 3
- trigger: state
entity_id: sensor.lora_mailbox
id: bat
to: 0xLBAT
for: 3
conditions:
- condition: []
actions:
- choose:
- conditions:
- condition: trigger
id: mail
sequence:
- action: notify.amberthebot
data:
message: You've got mail!
data:
inline_keyboard:
- Received:/received, Mute:/donothing
- conditions:
- condition: trigger
id: bat
sequence:
- action: script.text_notify
data:
who: amber
title: Mailbox
message: Mailbox battery is low!
- action: python_script.set_state
data:
entity_id: sensor.lora_mailbox
state: received
- alias: Telegram - You got mail received
triggers:
- trigger: event
event_type: telegram_callback
event_data:
data: /received
actions:
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: OK, turning off notification
- action: telegram_bot.edit_replymarkup
data:
message_id: '{{ trigger.event.data.message.message_id }}'
chat_id: '{{ trigger.event.data.chat_id }}'
inline_keyboard: []
- action: python_script.set_state
data:
entity_id: sensor.lora_mailbox
state: received
- action: script.mailbox_reset
- alias: Telegram - Do Nothing
triggers:
- trigger: event
event_type: telegram_callback
event_data:
data: /donothing
actions:
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: OK, no action taken
- action: telegram_bot.edit_replymarkup
data:
message_id: '{{ trigger.event.data.message.message_id }}'
chat_id: '{{ trigger.event.data.chat_id }}'
inline_keyboard: []
- alias: Control Devices
initial_state: 'on'
triggers:
- trigger: event
event_type: telegram_text
conditions:
- condition: template
value_template: "{%- set text = trigger.event.data.text|lower -%} {%- set text\
\ = text.split(' ') -%} {%- if (text[0] == 'turn' or text[0] == 'switch') and\
\ (text[1] == 'on' or text[1] == 'off') -%}\n true\n{%- endif -%}"
actions:
- action: telegram_bot.send_message
data:
message: '{%- set device = trigger.event.data.text|lower|replace(''turn on '','''')|replace(''turn
off '','''')|replace(''switch on '','''')|replace(''switch off '','''') -%}
{%- for entity in states.group.controllable_devices.attributes.entity_id if
states[entity.split(''.'')[0]][entity.split(''.'')[1]].name|lower == device
-%} OK, {{ trigger.event.data.text|lower|replace(''turn'',''turning'')|replace(''switch'',''switching'')
}}. {%- else -%} I''m sorry. I cannot find the device named {{device}} in
the house. {%- endfor -%}'
title: ''
target: '{{ trigger.event.data.chat_id }}'
- condition: template
value_template: '{%- set device = trigger.event.data.text|lower|replace(''turn
on '','''')|replace(''turn off '','''')|replace(''switch on '','''')|replace(''switch
off '','''') -%} {%- for entity in states.group.controllable_devices.attributes.entity_id
if states[entity.split(''.'')[0]][entity.split(''.'')[1]].name|lower == device
-%} true {%- else -%} false {%- endfor -%}'
- action: '{%- set text = trigger.event.data.text|lower -%} {%- set text = text.split(''
'') -%} {%- set onoff = text[1] -%} homeassistant.turn_{{onoff}}'
data:
entity_id: '{%- set device = trigger.event.data.text|lower|replace(''turn on
'','''')|replace(''turn off '','''')|replace(''switch on '','''')|replace(''switch
off '','''') -%} {%- for entity in states.group.controllable_devices.attributes.entity_id
if states[entity.split(''.'')[0]][entity.split(''.'')[1]].name|lower == device
-%} {{ entity }} {%- endfor -%}'
- alias: turn off light after timeout
triggers:
- trigger: state
entity_id: light.g_1
to: 'on'
for:
minutes: 15
actions:
- action: light.turn_off
data:
entity_id: '{{ trigger.entity_id }}'
- alias: closet storage room auto-off
triggers:
- trigger: state
entity_id:
- binary_sensor.master_clo_door_contact
- binary_sensor.storage_door_contact
to: 'off'
for: 30
actions:
- action: light.turn_off
target:
entity_id: light.{{ trigger.to_state.name }}
- alias: Lights out Before leaving
triggers:
- entity_id: binary_sensor.genkan_doorlock_button
trigger: state
to: 'on'
actions:
- action: script.lights_out
- alias: Duc Presence Alone
triggers:
- trigger: state
entity_id: binary_sensor.duc_presence_alone
conditions: []
actions:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.duc_presence_alone
state: 'off'
sequence:
- action: input_boolean.turn_on
entity_id: input_boolean.disable_motion_lights
default:
- action: input_boolean.turn_off
entity_id: input_boolean.disable_motion_lights
- id: unavailable_entities_notification
alias: Unavailable Entities Notification
description: Create persistent notification if unavailable entities, dismiss if
none.
mode: restart
triggers:
- trigger: state
entity_id: sensor.unavailable_entities
attribute: entity_id
to: null
conditions:
- condition: template
alias: Sensor state is a valid numerical value
value_template: "{{ is_number(trigger.from_state.state)\n and is_number(trigger.to_state.state)\
\ }}\n"
actions:
- if:
- condition: numeric_state
entity_id: sensor.unavailable_entities
below: 1
then:
- action: persistent_notification.dismiss
data:
notification_id: unavailable_entities
else:
- action: persistent_notification.create
data:
notification_id: unavailable_entities
title: Unavailable Entities
message: '{{ state_attr(''sensor.unavailable_entities'',''entity_id'')|join(''
'') }}'
- alias: motion washroom auto-on
mode: parallel
triggers:
- trigger: template
value_template: '{{ state_attr(''binary_sensor.wash_occupied'', ''initiated'')
== true }}'
- trigger: state
entity_id: binary_sensor.washer_door_button
to: 'on'
id: shower
actions:
- choose:
- conditions:
- condition: trigger
id: shower
sequence:
- action: light.toggle
entity_id: light.shower
default:
- action: light.turn_on
entity_id: light.laundry, light.sink, light.vanity
- alias: motion washroom auto-off
mode: parallel
triggers:
- trigger: state
entity_id: binary_sensor.wash_occupied
to: 'off'
conditions:
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'', ''on'')
}}'
actions:
- service_template: light.turn_{{ 'on' if is_state('light.shower', 'on') else 'off'
}}
entity_id: light.laundry
- delay: 10
- service_template: light.turn_{{ 'on' if is_state('light.shower', 'on') else 'off'
}}
entity_id: light.sink, light.vanity
- alias: Replace Toilet Airfreshener Notification
triggers:
- trigger: numeric_state
entity_id: sensor.wc_airfreshener_can
below: 10
actions:
- action: script.email_notify
data:
title: Replace WC Airfreshener
who: duc
message: <b>Today is {{ now().strftime( '%B %d, %Y') }} </b> <br> <br> The wc
air freshener bottle needs to be replaced. It has about {{ states('sensor.wc_airfreshener_can')
}}% left.<br> <br>
- alias: motion wc room
triggers:
- trigger: state
entity_id: binary_sensor.wc_occupied, binary_sensor.wc_door_contact
to: 'on'
- trigger: state
entity_id: binary_sensor.wc_occupied
to: 'off'
id: 'off'
- trigger: state
entity_id: input_boolean.engage_toilet_airfreshener
to: 'on'
for: 00:03:00
id: air
- trigger: template
value_template: '{{ is_state(''light.wc'', [''unavailable'',''off'']) }}'
id: reset
- trigger: numeric_state
entity_id: sensor.wc_airfreshener_volume_percent
above: 0.8
below: 20
for: 15
id: air
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id: 'off'
sequence:
- action: homeassistant.turn_off
entity_id: input_boolean.engage_toilet_airfreshener
- condition: template
value_template: '{{ not is_state(''input_boolean.disable_motion_lights'',
''on'') }}'
- condition: template
value_template: '{{not is_state(''input_boolean.guest_mode'', ''on'') }}'
- action: light.turn_off
entity_id: light.wc
- conditions:
- condition: trigger
id: air
sequence:
- condition: template
value_template: '{{ is_state(''light.wc'', ''on'') }}'
- action: switch.turn_on
entity_id: switch.wc_airfreshener
- conditions:
- condition: trigger
id: reset
sequence:
- action: homeassistant.turn_off
entity_id: input_boolean.engage_toilet_airfreshener
default:
- action: light.turn_on
entity_id: light.wc_1
- action: homeassistant.turn_on
entity_id: input_boolean.engage_toilet_airfreshener
- alias: Enable Toilet Seat Heater Upon Arrival
triggers:
- trigger: state
entity_id: input_select.home_mode
conditions:
- condition: template
value_template: '{{ not is_state(''sensor.season'', ''summer'') }}'
actions:
choose:
- conditions: '{{ trigger.to_state.state == ''Away'' or trigger.to_state.state
== ''Vacation'' }}'
sequence:
- action: script.toilet_seat_off_heat
- conditions: "{{ trigger.to_state.state == 'Home' and\n states('sensor.aio_human_sensor_entrance_temperature')|\
\ int(0) > 21 }}\n"
sequence:
- action: script.toilet_seat_off_heat
- conditions: "{{ trigger.to_state.state == 'Home' and\n states('sensor.aio_human_sensor_entrance_temperature')|\
\ int(0) <= 10}}\n"
sequence:
- action: script.toilet_seat_high_heat
- conditions: "{{ trigger.to_state.state == 'Home' and\n states('sensor.aio_human_sensor_entrance_temperature')|\
\ int(0) <= 14 }}\n"
sequence:
- action: script.toilet_seat_med_heat
- conditions: "{{ trigger.to_state.state == 'Home' and\n states('sensor.aio_human_sensor_entrance_temperature')|\
\ int(0) <= 20 }}\n"
sequence:
- action: script.toilet_seat_low_heat
- conditions: "{{ trigger.to_state.state == 'Returning' and\n states('sensor.aio_human_sensor_entrance_temperature')|\
\ int(0) <= 20 }}\n"
sequence:
- action: script.toilet_seat_low_heat
- alias: Adjust Toilet Seat Heater Temperature
triggers:
- trigger: state
entity_id: sensor.aio_human_sensor_entrance_temperature
conditions:
- condition: template
value_template: '{{ not is_state(''sensor.season'', ''summer'') }}'
- condition: template
value_template: '{{ not is_state(''binary_sensor.aio_human_sensor_online'', ''off'')
}}'
- condition: template
value_template: '{%- set last_toilet_heat_off_seconds = (now() - as_local(states.script.toilet_seat_off_heat.last_updated
)).seconds -%}
{%- if last_toilet_heat_off_seconds >= 600 %} true {% else %} false {% endif
%}
'
actions:
choose:
- conditions: "{{ states('sensor.aio_human_sensor_entrance_temperature')| int(0)\
\ > 21 and\n is_state('input_select.home_mode', 'Home') }}\n"
sequence:
- action: script.toilet_seat_off_heat
- conditions: "{{ states('sensor.aio_human_sensor_entrance_temperature')| int(0)\
\ <= 10 and\n is_state('input_select.home_mode', 'Home') }}\n"
sequence:
- action: script.toilet_seat_high_heat
- conditions: "{{ states('sensor.aio_human_sensor_entrance_temperature')| int(0)\
\ <= 16 and\n is_state('input_select.home_mode', 'Home') }}\n"
sequence:
- action: script.toilet_seat_med_heat
- conditions: "{{ states('sensor.aio_human_sensor_entrance_temperature')| int(0)\
\ <= 20 and\n is_state('input_select.home_mode', 'Home') }}\n"
sequence:
- action: script.toilet_seat_low_heat
- alias: Hibernate Toilet Seat Heater
triggers:
- trigger: state
entity_id: sensor.season
to: summer
actions:
- delay: 1
- action: script.toilet_seat_off_heat
- id: enable_zigbee_join
alias: Enable Zigbee joining
triggers:
- trigger: state
entity_id: input_boolean.zigbee_permit_join
to: 'on'
actions:
- action: mqtt.publish
data:
topic: zigbee2mqtt/bridge/config/permit_join
payload: 'true'
- action: timer.start
data:
entity_id: timer.zigbee_permit_join
- id: disable_zigbee_join
alias: Disable Zigbee joining
triggers:
- trigger: state
entity_id: input_boolean.zigbee_permit_join
to: 'off'
actions:
- action: mqtt.publish
data:
payload: 'false'
topic: zigbee2mqtt/bridge/config/permit_join
- action: timer.cancel
data:
entity_id: timer.zigbee_permit_join
- id: disable_zigbee_join_timer
alias: Disable Zigbee joining by timer
triggers:
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.zigbee_permit_join
actions:
- action: mqtt.publish
data:
topic: zigbee2mqtt/bridge/config/permit_join
payload: 'false'
- action: input_boolean.turn_off
data:
entity_id: input_boolean.zigbee_permit_join