1161 lines
34 KiB
YAML
1161 lines
34 KiB
YAML
- alias: Unlock Front Door Upon Arrivial
|
|
id: arrival_unlock_door
|
|
trigger:
|
|
platform: state
|
|
entity_id:
|
|
- person.trevor
|
|
- person.emily
|
|
from: not_home
|
|
to: home
|
|
condition:
|
|
condition: and
|
|
conditions:
|
|
- condition: state
|
|
entity_id: lock.lock_front_door_lock
|
|
state: locked
|
|
- condition: time
|
|
after: 06:00:00
|
|
before: '23:00:00'
|
|
action:
|
|
- service: lock.unlock
|
|
entity_id: lock.lock_front_door_lock
|
|
- wait_template: '{{ is_state(''binary_sensor.front_door_sensor_window_door_is_open'',
|
|
''on'') }}'
|
|
timeout: 00:05:00
|
|
- service: script.relock_front_door
|
|
- alias: Bathroom Humidity Difference
|
|
id: bathroom_humidity_difference
|
|
trigger:
|
|
- platform: numeric_state
|
|
entity_id: sensor.bathroom_sensor_humidity
|
|
above: '70'
|
|
condition:
|
|
condition: numeric_state
|
|
entity_id: sensor.bathroom_humidity_diff
|
|
above: '10'
|
|
action:
|
|
- delay: 00:05:00
|
|
- service: homeassistant.turn_on
|
|
entity_id: script.bathroom_humidity
|
|
- alias: Bathroom light - presence detected
|
|
id: bathroom_movement
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.bathroom_presence_presence
|
|
to: 'on'
|
|
id: 'on'
|
|
- platform: state
|
|
entity_id: binary_sensor.bathroom_presence_presence
|
|
to: 'off'
|
|
id: 'off'
|
|
for:
|
|
minutes: 1
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'on'
|
|
- condition: state
|
|
entity_id: light.bathroom_light
|
|
state: 'off'
|
|
- condition: time
|
|
before: '22:00:00'
|
|
after: 05:00:00
|
|
sequence:
|
|
- action: light.turn_on
|
|
data_template:
|
|
entity_id: light.bathroom_light
|
|
transition: 2
|
|
brightness: "{%- if now().strftime('%H')|int >=19 -%}\n {{3|int}}\n{%-\
|
|
\ elif now().strftime('%H')|int >=17 -%}\n {{30|int}}\n{%- elif now().strftime('%H')\
|
|
\ |int >=8 -%}\n {{100|int}}\n{%- else -%}\n {{20|int}}\n{%- endif -%}"
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'off'
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.bathroom_light
|
|
mode: single
|
|
- alias: Bathroom Switch Double Tap
|
|
id: bathroom_switch_doubletap
|
|
trigger:
|
|
- platform: event
|
|
event_type: zwave_js_value_notification
|
|
event_data:
|
|
device_id: 8cb32c0ca9f0f5ed4c376b0cb02470fa
|
|
action:
|
|
- service: light.turn_on
|
|
data_template:
|
|
brightness_pct: "{% if trigger.event.data.value == 255 %}\n 100\n{% elif trigger.event.data.value\
|
|
\ == 0 %}\n 4\n{% endif %}\n"
|
|
entity_id: light.bathroom_light
|
|
- alias: Bedroom Switch Double Tap
|
|
id: bedroom_switch_doubletap
|
|
trigger:
|
|
- platform: event
|
|
event_type: zwave_js_value_notification
|
|
event_data:
|
|
device_id: b5f2fcf85f9b0d26d287adc42f27100a
|
|
action:
|
|
- service: light.turn_on
|
|
data_template:
|
|
brightness_pct: "{% if trigger.event.data.value == 255 %}\n 100\n{% elif trigger.event.data.value\
|
|
\ == 0 %}\n 10\n{% endif %}\n"
|
|
entity_id: light.bedroom_light
|
|
- alias: Christmas Tree - Movement
|
|
id: christmas_tree_movement
|
|
mode: single
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.living_room_presence_presence
|
|
to: 'on'
|
|
id: 'on'
|
|
- platform: state
|
|
entity_id: binary_sensor.living_room_presence_presence
|
|
to: 'off'
|
|
id: 'off'
|
|
for:
|
|
minutes: 10
|
|
- platform: state
|
|
entity_id: binary_sensor.kitchen_presence_presence
|
|
to: 'on'
|
|
id: 'on'
|
|
- platform: state
|
|
entity_id: binary_sensor.kitchen_presence_presence
|
|
to: 'off'
|
|
id: 'off'
|
|
for:
|
|
minutes: 10
|
|
- platform: state
|
|
entity_id: binary_sensor.hallway_sensor_motion
|
|
to: 'on'
|
|
id: 'on'
|
|
- platform: state
|
|
entity_id: binary_sensor.hallway_sensor_motion
|
|
to: 'off'
|
|
id: 'off'
|
|
for:
|
|
minutes: 10
|
|
conditions:
|
|
- condition: state
|
|
entity_id: group.presence
|
|
state: home
|
|
- condition: state
|
|
entity_id: sensor.christmas_tree_node_status
|
|
state: alive
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'on'
|
|
- condition: state
|
|
entity_id: group.presence
|
|
state: home
|
|
- condition: state
|
|
entity_id: switch.christmas_tree
|
|
state: 'off'
|
|
- condition: time
|
|
before: '22:00:00'
|
|
after: 04:00:00
|
|
sequence:
|
|
- action: switch.turn_on
|
|
target:
|
|
entity_id: switch.christmas_tree
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'off'
|
|
- condition: time
|
|
before: 05:30:00
|
|
after: '20:30:00'
|
|
sequence:
|
|
- action: switch.turn_off
|
|
target:
|
|
entity_id: switch.christmas_tree
|
|
- alias: Christmas Tree schedule
|
|
id: christmas_tree_schedule
|
|
mode: single
|
|
trigger:
|
|
- platform: time
|
|
id: start
|
|
at: 05:30:00
|
|
- platform: time
|
|
id: end
|
|
at: '20:30:00'
|
|
conditions:
|
|
- condition: state
|
|
entity_id: group.presence
|
|
state: home
|
|
- condition: state
|
|
entity_id: sensor.christmas_tree_node_status
|
|
state: alive
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: start
|
|
sequence:
|
|
- action: switch.turn_on
|
|
target:
|
|
entity_id: switch.christmas_tree
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: end
|
|
sequence:
|
|
- action: switch.turn_off
|
|
target:
|
|
entity_id: switch.christmas_tree
|
|
- alias: Hello Climate
|
|
id: climate_arrive
|
|
trigger:
|
|
platform: state
|
|
entity_id: group.climate_presence
|
|
from: not_home
|
|
to: home
|
|
action:
|
|
- service: climate.set_preset_mode
|
|
data:
|
|
entity_id: climate.home
|
|
preset_mode: home
|
|
- delay: 00:30:00
|
|
- service: ecobee.resume_program
|
|
data_template:
|
|
entity_id: climate.home
|
|
resume_all: '{% if is_state("sun.sun", "below_horizon") -%} true {%- else -%}
|
|
false {%- endif %}'
|
|
- alias: Goodbye Climate
|
|
id: climate_left
|
|
trigger:
|
|
platform: state
|
|
entity_id: group.climate_presence
|
|
from: home
|
|
to: not_home
|
|
action:
|
|
- service: climate.set_preset_mode
|
|
data:
|
|
entity_id: climate.home
|
|
preset_mode: away
|
|
- alias: Kitchen lights to get coffee
|
|
id: coffee_light
|
|
mode: single
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.hallway_sensor_motion
|
|
to: 'on'
|
|
condition:
|
|
condition: and
|
|
conditions:
|
|
- condition: numeric_state
|
|
entity_id: sun.sun
|
|
attribute: elevation
|
|
below: 4
|
|
- condition: state
|
|
entity_id: switch.coffee
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: light.kitchen_light_2
|
|
state: 'off'
|
|
action:
|
|
- service: automation.turn_off
|
|
entity_id: automation.kitchen_movement
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: light.kitchen_light_2
|
|
data:
|
|
brightness_pct: 3
|
|
- wait_template: '{{ is_state(''binary_sensor.kitchen_presence_presence'', ''on'')
|
|
}}'
|
|
timeout: 00:10:00
|
|
continue_on_timeout: true
|
|
- wait_template: '{{ is_state(''binary_sensor.kitchen_presence_presence'', ''off'')
|
|
}}'
|
|
timeout: 00:10:00
|
|
continue_on_timeout: true
|
|
- service: automation.turn_on
|
|
entity_id: automation.kitchen_movement
|
|
- condition: and
|
|
conditions:
|
|
- condition: state
|
|
entity_id: light.kitchen_light_1
|
|
state: 'off'
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id: light.kitchen_light_2
|
|
- alias: Beat Moccamaster's timer to the punch
|
|
id: coffee_monitor
|
|
trigger:
|
|
- platform: state
|
|
entity_id: switch.coffee
|
|
from: 'off'
|
|
to: 'on'
|
|
action:
|
|
- wait_template: '{{ is_state(''switch.coffee'', ''off'') }}'
|
|
timeout: 01:25:00
|
|
continue_on_timeout: true
|
|
- service: switch.turn_off
|
|
entity_id: switch.coffee
|
|
- alias: Turn off the ready switch when the Coffee starts
|
|
id: coffee_start_ready_off
|
|
trigger:
|
|
- platform: state
|
|
entity_id: switch.coffee
|
|
to: 'on'
|
|
action:
|
|
- service: input_boolean.turn_off
|
|
entity_id: input_boolean.coffee_set
|
|
- alias: Hallway Movement
|
|
id: hallway_movement
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.hallway_sensor_motion
|
|
to: 'on'
|
|
id: 'on'
|
|
- platform: state
|
|
entity_id: binary_sensor.hallway_sensor_motion
|
|
to: 'off'
|
|
id: 'off'
|
|
for:
|
|
minutes: 1
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'on'
|
|
- condition: state
|
|
entity_id: light.hallway_light
|
|
state: 'off'
|
|
- condition: state
|
|
entity_id: input_boolean.hallway_light_auto_on
|
|
state: 'on'
|
|
sequence:
|
|
- action: light.turn_on
|
|
data_template:
|
|
entity_id: light.hallway_light
|
|
transition: 2
|
|
brightness: "{%- if now().strftime('%H')|int >=19 -%}\n {{3|int}}\n{%-\
|
|
\ elif now().strftime('%H')|int >=17 -%}\n {{30|int}}\n{%- elif now().strftime('%H')\
|
|
\ |int >=8 -%}\n {{100|int}}\n{%- else -%}\n {{20|int}}\n{%- endif -%}"
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'off'
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.hallway_light
|
|
mode: single
|
|
- alias: Hallway Switch Double Tap
|
|
id: hallway_switch_doubletap
|
|
trigger:
|
|
- platform: event
|
|
event_type: zwave_js_value_notification
|
|
event_data:
|
|
device_id: db9121a9896e3f93d42ef75a8fc05ed1
|
|
action:
|
|
- service: light.turn_on
|
|
data_template:
|
|
brightness_pct: "{% if trigger.event.data.value == 255 %}\n 100\n{% elif trigger.event.data.value\
|
|
\ == 0 %}\n 10\n{% endif %}\n"
|
|
entity_id: light.hallway_light
|
|
- id: hippo_clear
|
|
alias: clear the Hippos schedule and/or make certain it has enough charge
|
|
trigger:
|
|
- platform: numeric_state
|
|
entity_id: sensor.next_hippo_departure_hrs
|
|
above: '24'
|
|
- platform: state
|
|
entity_id: binary_sensor.the_hippo_charger
|
|
from: 'on'
|
|
to: 'off'
|
|
- platform: state
|
|
entity_id: binary_sensor.the_hippo_charger
|
|
from: 'off'
|
|
to: 'on'
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: '{{(integration_entities(''scheduler'') | select(''is_state'',
|
|
''on'') | expand | sort(attribute="attributes.next_trigger") | first |
|
|
regex_findall("\''value\''\: \d+","") | regex_replace ("[^0-9]","") | int(default=69))
|
|
> 70 }}'
|
|
- condition: template
|
|
value_template: '{{float(states(''sensor.next_hippo_departure_hrs''), 7) >
|
|
6 }}'
|
|
- '{{float(states(''sensor.next_hippo_departure_hrs''), 25 ) < 24 }}'
|
|
- condition: numeric_state
|
|
entity_id: sensor.the_hippo_battery
|
|
below: 65
|
|
sequence:
|
|
- service: script.turn_on
|
|
data:
|
|
entity_id: script.hippo_minimum_charge
|
|
- conditions:
|
|
- '{{float(states(''sensor.next_hippo_departure_hrs''), 25) > 24 }}'
|
|
- condition: state
|
|
entity_id: device_tracker.the_hippo_location_tracker
|
|
state: home
|
|
sequence:
|
|
- alias: Wait until car is in park
|
|
wait_template: '{{ is_state(''sensor.the_hippo_shift_state'', ''P'') }}'
|
|
- service: tesla_custom.api
|
|
data:
|
|
command: SCHEDULED_DEPARTURE
|
|
parameters:
|
|
path_vars:
|
|
vehicle_id: '{{ state_attr(''binary_sensor.the_hippo_online'', ''id'')
|
|
}}'
|
|
enable: true
|
|
departure_time: 1
|
|
preconditioning_enabled: false
|
|
preconditioning_weekdays_only: false
|
|
off_peak_charging_enabled: false
|
|
off_peak_charging_weekdays_only: false
|
|
end_off_peak_time: 1
|
|
wake_if_asleep: true
|
|
- service: tesla_custom.api
|
|
data:
|
|
command: CHANGE_CHARGE_LIMIT
|
|
parameters:
|
|
path_vars:
|
|
vehicle_id: '{{ state_attr(''binary_sensor.the_hippo_online'', ''id'')
|
|
}}'
|
|
percent: 70
|
|
- id: hippo_departure
|
|
alias: Schedule the next Forest Hippo adventure
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: /15
|
|
condition:
|
|
- '{{int(states(''sensor.next_hippo_departure_hrs'')) < 14 }}'
|
|
- '{{state_attr(''binary_sensor.the_hippo_scheduled_departure'', ''Departure timestamp''
|
|
) != as_timestamp(states(''sensor.next_hippo_departure'' )) }}'
|
|
- condition: state
|
|
entity_id: sensor.the_hippo_shift_state
|
|
state: P
|
|
- condition: state
|
|
entity_id: device_tracker.the_hippo_location_tracker
|
|
state: home
|
|
action:
|
|
- service: tesla_custom.api
|
|
data:
|
|
command: CHANGE_CHARGE_LIMIT
|
|
parameters:
|
|
path_vars:
|
|
vehicle_id: '{{ state_attr(''binary_sensor.the_hippo_online'', ''id'') }}'
|
|
wake_if_asleep: true
|
|
percent: '{{integration_entities(''scheduler'') | select(''is_state'', ''on'')
|
|
| expand | sort(attribute="attributes.next_trigger") | first | regex_findall("\''value\''\:
|
|
\d+","") | regex_replace ("[^0-9]","") | int(default=69) }}'
|
|
- delay: 00:00:45
|
|
- service: switch.turn_off
|
|
entity_id: switch.the_hippo_charger
|
|
- service: tesla_custom.api
|
|
data:
|
|
command: SCHEDULED_DEPARTURE
|
|
parameters:
|
|
path_vars:
|
|
vehicle_id: '{{ state_attr(''binary_sensor.the_hippo_online'', ''id'') }}'
|
|
enable: true
|
|
departure_time: '{{(states(''sensor.next_hippo_departure'') | as_timestamp
|
|
| timestamp_custom(''%H:%M''))[0:2] | int * 60 + (states(''sensor.next_hippo_departure'')
|
|
| as_timestamp | timestamp_custom(''%H:%M''))[3:5] | int}}'
|
|
preconditioning_enabled: true
|
|
preconditioning_weekdays_only: false
|
|
off_peak_charging_enabled: '{{(integration_entities(''scheduler'') | select(''is_state'',
|
|
''on'') | expand | sort(attribute="attributes.next_trigger") | first |
|
|
regex_findall("\''value\''\: \d+","") | regex_replace ("[^0-9]","") | int(default=69))
|
|
> 70 }}'
|
|
off_peak_charging_weekdays_only: false
|
|
end_off_peak_time: '{{(states(''sensor.next_hippo_departure'') | as_timestamp
|
|
| timestamp_custom(''%H:%M''))[0:2] | int * 60 + (states(''sensor.next_hippo_departure'')
|
|
| as_timestamp | timestamp_custom(''%H:%M''))[3:5] | int}}'
|
|
- service: input_datetime.set_datetime
|
|
target:
|
|
entity_id: input_datetime.hippo_departure
|
|
data_template:
|
|
datetime: '{{states(''sensor.next_hippo_departure'')}}'
|
|
- delay: 00:07:00
|
|
- service: notify.phones
|
|
data:
|
|
title: Hippo charge level set
|
|
message: The Hippo's charge level was set to {{states('number.the_hippo_charge_limit')}}%
|
|
for an adventure on {{states('sensor.next_hippo_departure') | as_timestamp
|
|
| timestamp_custom('%A at %H%M')}}. The charger is currently {{ iif(is_state('binary_sensor.the_hippo_charging',
|
|
'on'), 'charging', iif(is_state('binary_sensor.the_hippo_charging', 'off'),
|
|
'paused', 'unknown')) }}.
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: '{{(integration_entities(''scheduler'') | select(''is_state'',
|
|
''on'') | expand | sort(attribute="attributes.next_trigger") | first |
|
|
regex_findall("\''value\''\: \d+","") | regex_replace ("[^0-9]","") | int(default=69))
|
|
> 70 }}'
|
|
- condition: template
|
|
value_template: '{{int(states(''sensor.next_hippo_departure_hrs'')) > 6 }}'
|
|
- condition: numeric_state
|
|
entity_id: sensor.the_hippo_battery
|
|
below: 65
|
|
sequence:
|
|
- service: script.turn_on
|
|
data:
|
|
entity_id: script.hippo_minimum_charge
|
|
- id: hippo_psi
|
|
alias: Check the Hippo tire pressure
|
|
trigger:
|
|
- platform: numeric_state
|
|
entity_id:
|
|
- sensor.the_hippo_tpms_front_right
|
|
- sensor.the_hippo_tpms_rear_right
|
|
- sensor.the_hippo_tpms_front_left
|
|
- sensor.the_hippo_tpms_rear_left
|
|
below: 37.5
|
|
action:
|
|
- service: notify.phones
|
|
data_template:
|
|
title: Below optimal tire pressure
|
|
message: '{{ trigger.to_state.name }} is {{ trigger.to_state.state | round(2)
|
|
}}'
|
|
- alias: Is the hottub going to freeze?
|
|
id: hottub_freezing
|
|
trigger:
|
|
- platform: numeric_state
|
|
entity_id: sensor.temperature_0d
|
|
below: '32'
|
|
condition:
|
|
- condition: numeric_state
|
|
entity_id: sensor.temperature_1d
|
|
below: '32'
|
|
- condition: numeric_state
|
|
entity_id: sensor.temperature_2d
|
|
below: '32'
|
|
action:
|
|
- service: notify.phones
|
|
data:
|
|
title: Freeze Warning
|
|
message: 'Turn on Hot tub - future 12 hr period temps are: {{states(''sensor.temperature_0d'')
|
|
}}/{{states(''sensor.temperature_1d'') }}/{{states(''sensor.temperature_2d'')
|
|
}} {{ state_attr(''sensor.temperature_2d'', ''unit_of_measurement'') }}'
|
|
- alias: Display correct HVAC controls
|
|
id: hvac_controls
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- climate.home
|
|
- climate.window_a_c
|
|
from: 'off'
|
|
conditions:
|
|
- not:
|
|
- condition: state
|
|
entity_id: climate.home
|
|
state: unknown
|
|
- condition: state
|
|
entity_id: climate.window_a_c
|
|
state: unknown
|
|
actions:
|
|
- choose:
|
|
- conditions: '{{ trigger.to_state.object_id == ''home'' }}'
|
|
sequence:
|
|
- service: switch.turn_on
|
|
entity_id: switch.ac_or_furnace
|
|
- service: climate.turn_off
|
|
entity_id: climate.window_a_c
|
|
- conditions: '{{ trigger.to_state.object_id == ''window_a_c'' }}'
|
|
sequence:
|
|
- service: switch.turn_off
|
|
entity_id: switch.ac_or_furnace
|
|
- service: climate.turn_off
|
|
entity_id: climate.home
|
|
- alias: Kitchen Lights Sync
|
|
id: kitchen_lights_sync
|
|
trigger:
|
|
platform: state
|
|
entity_id:
|
|
- light.kitchen_light_1
|
|
- light.kitchen_light_2
|
|
from: 'on'
|
|
to: 'off'
|
|
for: 00:30:00
|
|
condition:
|
|
alias: If one of the kitchen lights still says it is on
|
|
or:
|
|
- condition: state
|
|
entity_id: light.kitchen_light_1
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: light.kitchen_light_2
|
|
state: 'on'
|
|
action:
|
|
- service: light.turn_off
|
|
entity_id:
|
|
- light.kitchen_light_1
|
|
- light.kitchen_light_2
|
|
- alias: Kitchen light - presence detected
|
|
id: kitchen_movement
|
|
initial_state: true
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.kitchen_presence_presence
|
|
to: 'on'
|
|
id: 'on'
|
|
- platform: state
|
|
entity_id: binary_sensor.kitchen_presence_presence
|
|
to: 'off'
|
|
id: 'off'
|
|
for:
|
|
minutes: 1
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'on'
|
|
- condition: state
|
|
entity_id: light.all_kitchen_lights
|
|
state: 'off'
|
|
- condition: time
|
|
before: '22:00:00'
|
|
after: 05:00:00
|
|
sequence:
|
|
- action: light.turn_on
|
|
data_template:
|
|
entity_id: light.all_kitchen_lights
|
|
transition: 2
|
|
brightness: "{%- if now().strftime('%H')|int >=19 -%}\n {{3|int}}\n{%-\
|
|
\ elif now().strftime('%H')|int >=17 -%}\n {{30|int}}\n{%- elif now().strftime('%H')\
|
|
\ |int >=8 -%}\n {{100|int}}\n{%- else -%}\n {{20|int}}\n{%- endif -%}"
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'off'
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.all_kitchen_lights
|
|
mode: single
|
|
- alias: Kitchen Switch 1 Double Tap
|
|
id: kitchen_switch_1_doubletap
|
|
trigger:
|
|
- platform: event
|
|
event_type: zwave_js_value_notification
|
|
event_data:
|
|
device_id: 7d27e04aa4d14b076542e5b92dc999a0
|
|
action:
|
|
- service: light.turn_on
|
|
data_template:
|
|
brightness_pct: "{% if trigger.event.data.value == 255 %}\n 100\n{% elif trigger.event.data.value\
|
|
\ == 0 %}\n 10\n{% endif %}\n"
|
|
entity_id: light.kitchen_light_1
|
|
- service: light.turn_on
|
|
data_template:
|
|
brightness_pct: "{% if trigger.event.data.value == 255 %}\n 100\n{% elif trigger.event.data.value\
|
|
\ == 0 %}\n 10\n{% endif %}\n"
|
|
entity_id: light.kitchen_light_2
|
|
- alias: Kitchen Switch 2 Double Tap
|
|
id: kitchen_switch_2_doubletap
|
|
trigger:
|
|
- platform: event
|
|
event_type: zwave_js_value_notification
|
|
event_data:
|
|
device_id: 38f0169c956322eb2cb54645abc733be
|
|
action:
|
|
- service: light.turn_on
|
|
data_template:
|
|
brightness_pct: "{% if trigger.event.data.value == 255 %}\n 100\n{% elif trigger.event.data.value\
|
|
\ == 0 %}\n 10\n{% endif %}\n"
|
|
entity_id: light.kitchen_light_2
|
|
- service: light.turn_on
|
|
data_template:
|
|
brightness_pct: "{% if trigger.event.data.value == 255 %}\n 100\n{% elif trigger.event.data.value\
|
|
\ == 0 %}\n 10\n{% endif %}\n"
|
|
entity_id: light.kitchen_light_1
|
|
- id: night_security_check
|
|
alias: Check that the door is locked at night
|
|
trigger:
|
|
platform: state
|
|
entity_id: group.all_lights
|
|
from: 'on'
|
|
to: 'off'
|
|
condition:
|
|
condition: time
|
|
after: '19:00:00'
|
|
before: 05:00:00
|
|
action:
|
|
- service: script.relock_front_door
|
|
- alias: Office light - presence detected
|
|
id: office_movement
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.office_presence_presence
|
|
to: 'on'
|
|
id: 'on'
|
|
- platform: state
|
|
entity_id: binary_sensor.office_presence_presence
|
|
to: 'off'
|
|
id: 'off'
|
|
for:
|
|
minutes: 2
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'on'
|
|
- condition: state
|
|
entity_id: light.office_light
|
|
state: 'off'
|
|
- condition: state
|
|
entity_id: input_boolean.office_light_auto_on
|
|
state: 'on'
|
|
sequence:
|
|
- action: light.turn_on
|
|
data_template:
|
|
entity_id: light.office_lamp
|
|
transition: 2
|
|
brightness: "{%- if now().strftime('%H')|int >=19 -%}\n {{3|int}}\n{%-\
|
|
\ elif now().strftime('%H')|int >=17 -%}\n {{30|int}}\n{%- elif now().strftime('%H')\
|
|
\ |int >=8 -%}\n {{100|int}}\n{%- else -%}\n {{20|int}}\n{%- endif -%}"
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'on'
|
|
- condition: state
|
|
entity_id: light.office_light
|
|
state: 'off'
|
|
- condition: time
|
|
before: '18:00:00'
|
|
after: 08:00:00
|
|
sequence:
|
|
- action: light.turn_on
|
|
data_template:
|
|
entity_id: light.office_light
|
|
transition: 2
|
|
brightness: "{%- if now().strftime('%H')|int >=19 -%}\n {{3|int}}\n\
|
|
{%- elif now().strftime('%H')|int >=17 -%}\n {{30|int}}\n{%- elif\
|
|
\ now().strftime('%H') |int >=8 -%}\n {{100|int}}\n{%- else -%}\n\
|
|
\ {{20|int}}\n{%- endif -%}"
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'off'
|
|
- condition: state
|
|
entity_id: input_boolean.office_light_auto_on
|
|
state: 'on'
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.office_light
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.office_lamp
|
|
mode: single
|
|
- alias: Office Switch Double Tap
|
|
id: office_switch_doubletap
|
|
trigger:
|
|
- platform: event
|
|
event_type: zwave_js_value_notification
|
|
event_data:
|
|
device_id: 6adf396592828be8ab788674e9113f43
|
|
action:
|
|
- action: light.turn_on
|
|
data_template:
|
|
brightness_pct: "{% if trigger.event.data.value == 255 %}\n 100\n{% elif trigger.event.data.value\
|
|
\ == 0 %}\n 10\n{% endif %}\n"
|
|
entity_id: light.office_light
|
|
- action: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.office_light_auto_on
|
|
- alias: Office switch turned off
|
|
id: office_switch_turned_off
|
|
initial_state: 'on'
|
|
trigger:
|
|
- platform: state
|
|
entity_id: light.office_light
|
|
to: 'off'
|
|
condition:
|
|
- condition: state
|
|
entity_id: input_boolean.office_light_auto_on
|
|
state: 'off'
|
|
action:
|
|
- action: input_boolean.turn_on
|
|
entity_id: input_boolean.office_light_auto_on
|
|
- alias: Open the windows if it is cooler outside than in
|
|
id: open_windows
|
|
trigger:
|
|
- platform: template
|
|
value_template: '{{ (states(''sensor.kbfi_temperature'')|float(0)|round(0) - (states(''sensor.house_avg_temp'')|float(0)|round(0)
|
|
| int) + 3 ) <= 0 }}'
|
|
- platform: template
|
|
value_template: '{{states(''sensor.temperature_1d'')| int(70) <= 60}}'
|
|
condition:
|
|
- '{{(states(''sensor.house_avg_temp'')|float(0)|round(0) | int(70)) >= 72 }}'
|
|
- condition: sun
|
|
after: sunset
|
|
after_offset: -04:00:00
|
|
- condition: time
|
|
before: '22:00:00'
|
|
- condition: state
|
|
entity_id: group.presence
|
|
state: home
|
|
- condition: state
|
|
entity_id: climate.home
|
|
state: 'off'
|
|
action:
|
|
- if:
|
|
- alias: Is it after 6pm?
|
|
condition: time
|
|
after: '18:00:00'
|
|
then:
|
|
- service: notify.phones
|
|
data:
|
|
title: Throw open the windows
|
|
message: It is currently {{states('sensor.kbfi_temperature')|float(0)|round(0)
|
|
| int}}°F outside and {{states('sensor.house_avg_temp')|float(0)|round(0)
|
|
| int}}°F inside with an overnight low of {{states('sensor.temperature_0d')|
|
|
int}}°F
|
|
else:
|
|
- service: notify.phones
|
|
data:
|
|
title: Throw open the windows
|
|
message: It is currently {{states('sensor.kbfi_temperature')|float(0)|round(0)
|
|
| int}}°F outside and {{states('sensor.house_avg_temp')|float(0)|round(0)
|
|
| int}}°F inside with an overnight low of {{states('sensor.temperature_1d')|
|
|
int}}°F
|
|
- alias: Plant Schedule - Off
|
|
id: plant_schedule_off
|
|
trigger:
|
|
- platform: time
|
|
at: '19:45:00'
|
|
condition:
|
|
condition: state
|
|
entity_id: group.plants
|
|
state: 'on'
|
|
action:
|
|
service: homeassistant.turn_off
|
|
entity_id: group.plants
|
|
- alias: Plant Schedule - On
|
|
id: plant_schedule_on
|
|
trigger:
|
|
- platform: time
|
|
at: 07:30:00
|
|
condition:
|
|
condition: state
|
|
entity_id: group.plants
|
|
state: 'off'
|
|
action:
|
|
- delay: '{{ iif(is_state(''binary_sensor.workday_sensor'', ''off''), ''01:00:00'',
|
|
''00:00:01'') }}'
|
|
- service: homeassistant.turn_on
|
|
entity_id: group.plants
|
|
- alias: Turn on the porch light
|
|
id: porch_light_door_open
|
|
triggers:
|
|
- trigger: state
|
|
entity_id: binary_sensor.front_door_sensor_window_door_is_open
|
|
from: 'off'
|
|
to: 'on'
|
|
- trigger: state
|
|
entity_id: include ../../devices.yaml
|
|
from: not_home
|
|
to: home
|
|
- trigger: state
|
|
entity_id: lock.lock_front_door_lock
|
|
from: locked
|
|
to: unlocked
|
|
condition:
|
|
- condition: template
|
|
value_template: '{{ state_attr("sun.sun", "elevation") < 4 }}'
|
|
- condition: state
|
|
entity_id: switch.porch_light
|
|
state: 'off'
|
|
action:
|
|
- service: switch.turn_on
|
|
target:
|
|
entity_id: switch.porch_light
|
|
- wait_template: '{{ is_state(''binary_sensor.front_door_sensor_window_door_is_open'',
|
|
''off'') }}'
|
|
timeout: 00:05:00
|
|
- delay: 00:02:00
|
|
- service: switch.turn_off
|
|
target:
|
|
entity_id: switch.porch_light
|
|
- alias: Spare Bedroom light - presence detected
|
|
id: spare_bedroom_movement
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.spare_bedroom_presence_presence
|
|
to: 'on'
|
|
id: 'on'
|
|
- platform: state
|
|
entity_id: binary_sensor.spare_bedroom_presence_presence
|
|
to: 'off'
|
|
id: 'off'
|
|
for:
|
|
minutes: 1
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'on'
|
|
- condition: state
|
|
entity_id: light.spare_bedroom_light
|
|
state: 'off'
|
|
- condition: state
|
|
entity_id: input_boolean.spare_bedroom_light_auto_on
|
|
state: 'on'
|
|
sequence:
|
|
- action: light.turn_on
|
|
data_template:
|
|
entity_id: light.spare_bedroom_light
|
|
transition: 2
|
|
brightness: "{%- if now().strftime('%H')|int >=19 -%}\n {{3|int}}\n{%-\
|
|
\ elif now().strftime('%H')|int >=17 -%}\n {{30|int}}\n{%- elif now().strftime('%H')\
|
|
\ |int >=8 -%}\n {{100|int}}\n{%- else -%}\n {{20|int}}\n{%- endif -%}"
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: 'off'
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.spare_bedroom_light
|
|
mode: single
|
|
- alias: Spare Bedroom Switch Double Tap
|
|
id: spare_bedroom_switch_double_tap
|
|
trigger:
|
|
- platform: event
|
|
event_type: zwave_js_value_notification
|
|
event_data:
|
|
device_id: 035feddac732eb4681d7fb3800f2fd56
|
|
action:
|
|
- service: light.turn_on
|
|
data_template:
|
|
brightness_pct: "{% if trigger.event.data.value == 255 %}\n 100\n{% elif trigger.event.data.value\
|
|
\ == 0 %}\n 10\n{% endif %}\n"
|
|
entity_id: light.spare_bedroom_light
|
|
- alias: Start sound system when living room tv starts
|
|
id: start_tv
|
|
trigger:
|
|
platform: state
|
|
entity_id: remote.smart_tv_pro
|
|
to: 'on'
|
|
condition: null
|
|
action:
|
|
service: remote.send_command
|
|
target:
|
|
entity_id: remote.harmony_hub
|
|
data:
|
|
command:
|
|
- PowerToggle
|
|
device: 40193695
|
|
- alias: Stop sound system when living room tv turns off
|
|
id: stop_tv
|
|
trigger:
|
|
platform: state
|
|
entity_id: remote.smart_tv_pro
|
|
from: 'on'
|
|
to: 'off'
|
|
condition: null
|
|
action:
|
|
service: remote.send_command
|
|
target:
|
|
entity_id: remote.harmony_hub
|
|
data:
|
|
command:
|
|
- PowerToggle
|
|
device: 40193695
|
|
- alias: Turn off TV
|
|
id: stop_tv_auto
|
|
trigger:
|
|
- platform: state
|
|
entity_id: media_player.living_room_tv
|
|
to: unavailable
|
|
for:
|
|
minutes: 3
|
|
- platform: state
|
|
entity_id: media_player.living_room_tv
|
|
to: 'off'
|
|
for:
|
|
minutes: 10
|
|
- platform: state
|
|
entity_id: media_player.living_room_tv
|
|
to: idle
|
|
for:
|
|
minutes: 30
|
|
condition:
|
|
- condition: and
|
|
conditions:
|
|
- condition: state
|
|
entity_id: remote.harmony_hub
|
|
state: 'on'
|
|
- condition: not
|
|
conditions:
|
|
- condition: state
|
|
entity_id: media_player.plex_living_room_tv
|
|
state: playing
|
|
action:
|
|
- service: remote.turn_off
|
|
entity_id: remote.harmony_hub
|
|
- alias: Trevor Sunrise Alarm
|
|
id: trevor_sunrise_alarm
|
|
trigger:
|
|
- platform: mqtt
|
|
topic: trevor/alarm
|
|
action:
|
|
- service: homeassistant.turn_on
|
|
entity_id: script.coffee_start
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.one_two_lamps
|
|
state: 'on'
|
|
sequence:
|
|
- service: light.turn_on
|
|
entity_id: light.bedroom_color_2
|
|
data:
|
|
brightness_pct: 1
|
|
rgb_color:
|
|
- 255
|
|
- 0
|
|
- 0
|
|
- service: light.turn_on
|
|
entity_id: light.bedroom_color_1
|
|
data:
|
|
brightness_pct: 1
|
|
rgb_color:
|
|
- 255
|
|
- 0
|
|
- 0
|
|
- delay: 00:00:10
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.one_two_lamps
|
|
state: 'on'
|
|
sequence:
|
|
- service: light.turn_on
|
|
entity_id: light.bedroom_color_2
|
|
data:
|
|
brightness_pct: 100
|
|
color_temp_kelvin: 2700
|
|
transition: 260
|
|
- service: input_boolean.turn_off
|
|
entity_id: input_boolean.one_two_lamps
|
|
- service: light.turn_on
|
|
entity_id: light.bedroom_color_1
|
|
data:
|
|
brightness_pct: 100
|
|
color_temp_kelvin: 2700
|
|
transition: 260
|
|
- alias: it is getting dark
|
|
id: sunset_response
|
|
trigger:
|
|
platform: sun
|
|
event: sunset
|
|
offset: -00:45:00
|
|
condition:
|
|
- condition: state
|
|
entity_id: group.presence
|
|
state: home
|
|
- condition: state
|
|
entity_id: light.dining_lights
|
|
state: 'off'
|
|
- condition: time
|
|
before: '20:00:00'
|
|
action:
|
|
- service: light.turn_on
|
|
entity_id: light.dining_lights
|
|
data:
|
|
brightness_pct: 1
|
|
- delay: 00:00:01
|
|
- service: light.turn_on
|
|
entity_id: light.dining_lights
|
|
data:
|
|
brightness_pct: 100
|
|
transition: 900
|
|
- alias: Set theme at startup, sunrise, and sunset
|
|
id: theme_set
|
|
triggers:
|
|
- trigger: homeassistant
|
|
event: start
|
|
- trigger: numeric_state
|
|
entity_id: sun.sun
|
|
attribute: elevation
|
|
above: 4
|
|
- trigger: numeric_state
|
|
entity_id: sun.sun
|
|
attribute: elevation
|
|
below: 4
|
|
action:
|
|
- if:
|
|
- alias: Is it day or night
|
|
condition: numeric_state
|
|
entity_id: sun.sun
|
|
attribute: elevation
|
|
above: 4
|
|
then:
|
|
- service: frontend.set_theme
|
|
data:
|
|
name: Google Theme Light
|
|
mode: dark
|
|
else:
|
|
- service: frontend.set_theme
|
|
data:
|
|
name: Google Theme Dark
|
|
mode: dark
|
|
- alias: Update groups
|
|
id: update_groups_all
|
|
trigger:
|
|
platform: homeassistant
|
|
event: start
|
|
action:
|
|
service: script.update_all_lights_group
|
|
- alias: Goodbye Sequence
|
|
id: goodbye_sequence
|
|
trigger:
|
|
platform: state
|
|
entity_id: group.presence
|
|
from: home
|
|
to: not_home
|
|
action:
|
|
- if:
|
|
- alias: Is the door open
|
|
condition: state
|
|
entity_id: binary_sensor.front_door_sensor_window_door_is_open
|
|
state: 'on'
|
|
- alias: Is the door sensor live and updating
|
|
condition: template
|
|
value_template: '{{ (utcnow() | as_timestamp - states(''sensor.front_door_sensor_last_seen'')|
|
|
as_timestamp) | int(0) < 7200 }}'
|
|
then:
|
|
- action: notify.phones
|
|
data:
|
|
title: The front door might be open
|
|
message: The last person just left but the door sensor, last seen {{ (((utcnow()
|
|
| as_timestamp - states('sensor.front_door_sensor_last_seen')| as_timestamp)
|
|
| int(0))/60 )| round(0)}} minutes ago, says it is still open
|
|
else:
|
|
- action: light.turn_off
|
|
entity_id: all
|
|
- service: script.relock_front_door
|
|
- alias: Update Z-Wave battery levels
|
|
id: zwave_battery_update
|
|
trigger:
|
|
- platform: time
|
|
at: 03:00:00
|
|
condition: '{{ (as_timestamp(now()) / 86400) | int % 3 == 1 }}'
|
|
action:
|
|
- service: zwave_js.refresh_value
|
|
data:
|
|
entity_id: "{%- set find_integration = 'zwave_js' %} {% set entities = states\
|
|
\ | map(attribute='entity_id') | list %} {%- set ns = namespace(entities =\
|
|
\ []) %} {%- for entity_id in entities %}\n {% if 'battery' in entity_id\
|
|
\ %}\n {%- set ids = device_attr(entity_id, 'identifiers') %}\n {%-\
|
|
\ if ids %}\n {%- set ids = ids | list | first %}\n {%- if ids and\
|
|
\ ids | length == 2 and ids[0] == find_integration %}\n {%- set ns.entities\
|
|
\ = ns.entities + [ entity_id ] %}\n {%- endif %}\n {%- endif %}\n\
|
|
\ {%- endif %}\n{%- endfor %} {{ ns.entities }}\n"
|
|
refresh_all_values: true
|
|
mode: single
|