AutomationDataset/ericz-home/ericz-home_automations.yaml

805 lines
19 KiB
YAML

- id: unset_auto_lock
alias: Unset AutoLock
triggers:
- trigger: time
at:
entity_id: sensor.galaxys24_next_alarm
offset: -00:05:00
- trigger: state
entity_id: input_boolean.sleep_mode
from: 'on'
to: 'off'
- trigger: state
entity_id: input_boolean.home_mode
from: 'off'
to: 'on'
- trigger: state
entity_id: lock.front_door_lock
from: locked
to: unlocked
- trigger: device
domain: mqtt
device_id: 9d09874393e2b3fd2b18669638d127be
type: action
subtype: config_double
conditions:
- condition: state
entity_id: input_boolean.auto_lock_front_door
state: 'on'
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.auto_lock_front_door
- id: set_auto_lock
alias: Set AutoLock
triggers:
- trigger: sun
event: sunset
- trigger: device
domain: mqtt
device_id: 9d09874393e2b3fd2b18669638d127be
type: action
subtype: config_single
conditions:
- condition: state
entity_id: input_boolean.auto_lock_front_door
state: 'off'
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.auto_lock_front_door
- id: auto_lock_on_led
alias: Auto lock ON LED color
triggers:
- trigger: state
entity_id: input_boolean.auto_lock_front_door
to: 'on'
actions:
- action: number.set_value
data:
value: 5
target:
entity_id:
- number.entryway_light_ledcolorwhenon
- number.entryway_light_ledcolorwhenoff
- action: mqtt.publish
data:
topic: zigbee2mqtt/Entryway Light/set
qos: '0'
payload: '{"led_effect": {"effect":"chase","color":5,"duration":10,"level":25}}
'
- id: auto_lock_off_led
alias: Auto lock OFF LED color
triggers:
- trigger: state
entity_id: input_boolean.auto_lock_front_door
to: 'off'
actions:
- action: mqtt.publish
data:
topic: zigbee2mqtt/Entryway Light/set
qos: '0'
payload: '{"led_effect": {"effect":"off"}}
'
- action: number.set_value
data:
value: 170
target:
entity_id:
- number.entryway_light_ledcolorwhenon
- number.entryway_light_ledcolorwhenoff
- id: charging_started
alias: Charging Started
triggers:
- trigger: state
entity_id: binary_sensor.my_ev6_ev_battery_charge
from: 'off'
to: 'on'
actions:
- action: script.notify_apps
data:
title: Car
message: 'Charging started. Currently at {{ states(''sensor.my_ev6_ev_battery_level'')
}}. Estimated charge duration {{ time_until(now() + timedelta(minutes=int(states(''sensor.my_ev6_estimated_charge_duration''))),
2) }}.
'
- id: charging_stopped
alias: Charging Stopped
triggers:
- trigger: state
entity_id: binary_sensor.my_ev6_ev_battery_charge
from: 'on'
to: 'off'
actions:
- action: script.notify_apps
data:
title: Car
message: 'Charging complete. Currently at {{ states(''sensor.my_ev6_ev_battery_level'')
}}. Estimated range {{ states(''sensor.my_ev6_ev_range'') }}.
'
- id: charged_full
alias: Charged to Full
triggers:
- trigger: state
entity_id: sensor.my_ev6_ev_battery_level
to: '100'
actions:
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.ev6_last_full_charge
data:
timestamp: '{{ now().timestamp() }}'
- id: detect_door_open
alias: Detect Door Open
triggers:
- trigger: state
entity_id: binary_sensor.front_door_contact
from: 'off'
to: 'on'
- trigger: state
entity_id: binary_sensor.sliding_door_contact
from: 'off'
to: 'on'
conditions:
- alias: not at home
condition: state
entity_id: input_boolean.home_mode
state: 'off'
actions:
- action: script.notify_apps
data:
title: Doors
message: '{{ state_attr(trigger.entity_id, ''friendly_name'') }} is open.'
- id: detect_front_door_open
alias: Detect Door Left Open
triggers:
- trigger: state
entity_id: binary_sensor.front_door_contact
to: 'on'
for:
minutes: 1
actions:
- action: script.notify_apps
data:
title: Doors
message: Front Door left open for 1 minute.
- id: fan_timer_stop
alias: Fan Timer Stop
triggers:
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.stop_fan
actions:
- action: switch.turn_off
target:
entity_id: switch.bedroom_fan
- id: fan_cancel_timer
alias: Fan Cancel Timer
triggers:
- trigger: state
entity_id: switch.bedroom_fan
to: 'off'
conditions:
- condition: state
entity_id: timer.stop_fan
state:
- active
- paused
actions:
- action: timer.cancel
target:
entity_id: timer.stop_fan
- id: fan_switch_on
alias: Switch on Fan
triggers:
- trigger: device
domain: mqtt
device_id: 9670c4fd4d208a0f5cce5158f1b7c786
type: action
subtype: up_double
- trigger: numeric_state
entity_id:
- weather.ksea
attribute: temperature
above: 80
conditions:
- condition: state
entity_id: switch.bedroom_fan
state: 'off'
actions:
- action: switch.turn_on
target:
entity_id: switch.bedroom_fan
- id: start_washing_machine
alias: Start Washing Machine
triggers:
- trigger: state
entity_id: binary_sensor.washing_machine_vibration
to: 'on'
for:
seconds: 7
conditions:
- condition: state
entity_id: input_select.washing_machine_status
state:
- 'off'
- completed
actions:
- action: input_select.select_option
target:
entity_id: input_select.washing_machine_status
data:
option: running
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.washing_machine_start
data:
timestamp: '{{ now().timestamp() }}'
- id: complete_washing_machine
alias: Complete Washing Machine
triggers:
- trigger: state
entity_id: binary_sensor.washing_machine_vibration
to: 'off'
for:
minutes: 5
conditions:
- condition: state
entity_id: input_select.washing_machine_status
state: running
actions:
- action: input_select.select_option
target:
entity_id: input_select.washing_machine_status
data:
option: completed
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.washing_machine_start
data:
timestamp: '{{ now().timestamp() }}'
- id: start_dryer
alias: Start Dryer
triggers:
- trigger: state
entity_id: binary_sensor.dryer_vibration
to: 'on'
for:
seconds: 10
conditions:
- condition: state
entity_id: input_select.dryer_status
state:
- 'off'
- completed
actions:
- action: input_select.select_option
target:
entity_id: input_select.dryer_status
data:
option: running
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.dryer_start
data:
timestamp: '{{ now().timestamp() }}'
- id: complete_dryer
alias: Complete Dryer
triggers:
- trigger: state
entity_id: binary_sensor.dryer_vibration
to: 'off'
for:
minutes: 2
conditions:
- condition: state
entity_id: input_select.dryer_status
state: running
actions:
- action: input_select.select_option
target:
entity_id: input_select.dryer_status
data:
option: completed
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.dryer_start
data:
timestamp: '{{ now().timestamp() }}'
- id: notify_laundry_completion
alias: Notify Laundry Complete
triggers:
- trigger: state
alias: Washing machine cycle complete
entity_id: input_select.washing_machine_status
from: running
to: completed
- trigger: state
alias: Dryer cycle complete
entity_id: input_select.dryer_status
from: running
to: completed
actions:
- action: script.notify_single_action_apps
data:
title: Laundry
message: '{{ trigger.alias }}.'
action_key: finish_laundry
action_title: Finish
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: finish_laundry
- platform: event
event_type: mobile_app_notification_cleared
event_data:
action: finish_laundry
timeout:
minutes: 30
continue_on_timeout: false
- choose:
- conditions: '{{ wait.trigger.event.event_type == ''mobile_app_notification_action''
}}'
sequence:
- action: input_select.select_option
target:
entity_id: '{{ trigger.entity_id }}'
data:
option: 'off'
- id: living_room_lights
alias: Turn on Living Room Lights
triggers:
- trigger: state
entity_id:
- person.eric
- person.laura
to: home
- trigger: sun
event: sunset
offset: -00:15:00
conditions:
- alias: sun down
condition: sun
after: sunset
after_offset: -00:15:00
- alias: lights off
condition: state
entity_id: light.twinkle_lights
state: 'off'
- alias: not away
condition: state
entity_id: input_boolean.home_mode
state: 'on'
- alias: not sleep
condition: state
entity_id: input_boolean.sleep_mode
state: 'off'
actions:
- choose:
- conditions:
- condition: state
entity_id: media_player.sony_xr_75x90j
state: 'on'
sequence:
- action: input_select.select_option
target:
entity_id: input_select.living_room_scene
data:
option: lo
default:
- action: input_select.select_option
target:
entity_id: input_select.living_room_scene
data:
option: mid
- id: select_living_room_scene
alias: Select Living Room Scene
triggers:
- trigger: state
entity_id: input_select.living_room_scene
actions:
- choose:
- conditions:
- condition: state
entity_id: input_select.living_room_scene
state: 'off'
sequence:
- action: scene.turn_on
target:
entity_id: scene.living_room_off
- conditions:
- condition: state
entity_id: input_select.living_room_scene
state: lo
sequence:
- action: scene.turn_on
target:
entity_id: scene.living_room_lo
- conditions:
- condition: state
entity_id: input_select.living_room_scene
state: mid
sequence:
- action: scene.turn_on
target:
entity_id: scene.living_room_mid
- conditions:
- condition: state
entity_id: input_select.living_room_scene
state: hi
sequence:
- action: scene.turn_on
target:
entity_id: scene.living_room_hi
- conditions:
- condition: state
entity_id: input_select.living_room_scene
state: max
sequence:
- action: scene.turn_on
target:
entity_id: scene.living_room_max
- id: select_next_living_room_scene
alias: Select Next Living Room Scene
triggers:
- trigger: device
domain: mqtt
device_id: 9d09874393e2b3fd2b18669638d127be
type: action
subtype: up_double
actions:
- action: input_select.select_next
target:
entity_id: input_select.living_room_scene
- id: select_prev_living_room_scene
alias: Select Previous Living Room Scene
triggers:
- trigger: device
domain: mqtt
device_id: 9d09874393e2b3fd2b18669638d127be
type: action
subtype: down_double
actions:
- action: input_select.select_previous
target:
entity_id: input_select.living_room_scene
- id: sleep_lights
alias: Turn Off All Lights
triggers:
- trigger: state
entity_id: input_boolean.sleep_mode
from: 'off'
to: 'on'
actions:
- action: input_select.select_option
target:
entity_id: input_select.living_room_scene
data:
option: 'off'
- action: light.turn_off
target:
entity_id: light.bedroom_light
- action: light.turn_off
target:
entity_id: light.dining_light
- id: notify_away_lights
alias: Notify When Lights Are On and Not Home
triggers:
- trigger: state
entity_id:
- light.torch_light
- light.arc_lamp
- light.twinkle_lights
- light.dining_light
- light.bedroom_light
- light.tv_room_light
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.home_mode
state: 'off'
actions:
- action: script.notify_apps
data:
title: Lights
message: The {{ trigger.entity_id }} light is on.
- id: daily_unlock_door
alias: Unlock the Door Daily
triggers:
- trigger: state
entity_id: input_boolean.sleep_mode
from: 'on'
to: 'off'
conditions:
- alias: at home
condition: state
entity_id: input_boolean.home_mode
state: 'on'
- alias: not away
condition: state
entity_id: input_boolean.away_mode
state: 'off'
- alias: door locked
not:
condition: state
entity_id: lock.front_door_lock
state: unlocked
actions:
- action: lock.unlock
target:
entity_id: lock.front_door_lock
- id: lock_door_nightly
alias: Lock the Door Nightly
triggers:
- trigger: state
entity_id: input_boolean.sleep_mode
from: 'off'
to: 'on'
conditions:
- alias: door unlocked
not:
condition: state
entity_id: lock.front_door_lock
state: locked
- alias: door closed
condition: state
entity_id: binary_sensor.front_door_contact
state: 'off'
actions:
- action: lock.lock
target:
entity_id: lock.front_door_lock
- id: auto_lock_door
alias: Auto Lock the Door
triggers:
- trigger: state
entity_id: binary_sensor.front_door_contact
from: 'on'
to: 'off'
for:
seconds: 1
conditions:
- condition: state
entity_id: input_boolean.auto_lock_front_door
state: 'on'
actions:
- action: lock.lock
target:
entity_id: lock.front_door_lock
- id: auto_unlock_door
alias: Auto Unlock the Door
triggers:
- trigger: state
entity_id:
- person.eric
- person.laura
to: home
conditions:
- alias: door locked
not:
condition: state
entity_id: lock.front_door_lock
state: unlocked
- alias: not sleep
condition: state
entity_id: input_boolean.sleep_mode
state: 'off'
- alias: not away
condition: state
entity_id: input_boolean.away_mode
state: 'off'
actions:
- action: lock.unlock
target:
entity_id: lock.front_door_lock
- id: notify_door
alias: Notify Front Door Lock
triggers:
- trigger: state
entity_id: lock.front_door_lock
not_to:
- unavailable
- unknown
not_from:
- unavailable
- unknown
actions:
- action: script.notify_apps
data:
title: Doors
message: Front door is {{ states('lock.front_door_lock') }}.
- id: update_erics_meds
alias: Update Eric's Meds
triggers:
- trigger: tag
tag_id: b47d9601-9f16-4ab4-b31e-11f6a529817e
actions:
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.erics_meds_last
data:
timestamp: '{{ now().timestamp() }}'
- id: remind_eric_meds
alias: Remind Eric to Take Meds
triggers:
- trigger: state
entity_id: input_boolean.sleep_mode
from: 'on'
to: 'off'
for:
minutes: 30
conditions:
- alias: at home
condition: state
entity_id: input_boolean.home_mode
state: 'on'
- '{{ as_local(as_datetime(states(''input_datetime.erics_meds_last''))) < today_at(''00:00'')
}}'
actions:
- action: script.notify_apps
data:
title: Medications
message: Reminder to take your meds.
- id: set_home_mode
alias: Set Home Mode
triggers:
- trigger: numeric_state
entity_id: zone.home
above: 0
conditions:
- condition: state
entity_id: input_boolean.home_mode
state: 'off'
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.home_mode
- id: unset_home_mode
alias: Unset Home Mode
triggers:
- trigger: numeric_state
entity_id: zone.home
below: 1
conditions:
- condition: state
entity_id: input_boolean.home_mode
state: 'on'
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.home_mode
- id: set_sleep_mode
alias: Set Sleep Mode
triggers:
- trigger: device
domain: mqtt
device_id: 9670c4fd4d208a0f5cce5158f1b7c786
type: action
subtype: config_single
- trigger: state
entity_id: sensor.galaxys24_do_not_disturb_sensor
not_to:
- 'off'
- unknown
- unavailable
conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'off'
actions:
- delay: 5
- action: input_boolean.turn_on
data:
entity_id: input_boolean.sleep_mode
- id: unset_sleep_mode
alias: Unset Sleep Mode
triggers:
- trigger: device
domain: mqtt
device_id: 9670c4fd4d208a0f5cce5158f1b7c786
type: action
subtype: config_double
conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'on'
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.sleep_mode
- id: sleep_mode_on_led
alias: Sleep mode ON LED color
triggers:
- trigger: state
entity_id: input_boolean.sleep_mode
to: 'on'
actions:
- action: number.set_value
data:
value: 200
target:
entity_id:
- number.bedroom_light_ledcolorwhenon
- number.bedroom_light_ledcolorwhenoff
- id: sleep_mode_off_led
alias: Sleep mode OFF LED color
triggers:
- trigger: state
entity_id: input_boolean.sleep_mode
to: 'off'
actions:
- action: number.set_value
data:
value: 170
target:
entity_id:
- number.bedroom_light_ledcolorwhenon
- number.bedroom_light_ledcolorwhenoff
- id: turn_on_light_and_tv
alias: Turn on Light and TV
triggers:
- device_id: 0d1e1ef71dff51f437db183f4d67d7ed
domain: mqtt
type: action
subtype: config_single
trigger: device
conditions:
- condition: state
entity_id: light.tv_room_light
state: 'off'
- condition: state
entity_id: media_player.sony_xr_75x90j
state: 'off'
actions:
- alias: turn on light
action: light.turn_on
target:
entity_id: light.tv_room_light
- alias: turn on tv
action: media_player.turn_on
target:
entity_id: media_player.sony_xr_75x90j
- id: turn_off_light_when_playing_media
alias: Turn off Light when Playing Media
triggers:
- platform: template
value_template: '{{ state_attr(''media_player.sony_tv'', ''media_content_type'')
is not none }}'
for:
seconds: 30
conditions:
- condition: state
entity_id: light.tv_room_light
state: 'on'
actions:
- alias: turn off light
action: light.turn_off
target:
entity_id: light.tv_room_light
- id: turn_on_light_when_tv_off
alias: Turn on Light when TV is Off
triggers:
- platform: state
entity_id: media_player.sony_xr_75x90j
to: 'off'
from: 'on'
conditions:
- condition: state
entity_id: light.tv_room_light
state: 'off'
- condition: sun
after: sunset
before: sunrise
before_offset: -00:30:00
actions:
- alias: turn on light
action: light.turn_on
target:
entity_id: light.tv_room_light