AutomationDataset/smccloud/smccloud_automations.yaml

484 lines
13 KiB
YAML

- alias: Bedtime
initial_state: true
trigger:
platform: time
at: input_datetime.bedtime
condition:
condition: state
entity_id: group.bedtimephones
state: home
action:
- service: light.turn_on
data:
entity_id: group.boysroomlight
brightness_pct: 10
- service: light.turn_on
data:
entity_id: light.shaun_nightstand
brightness_pct: 50
rgb_color:
- 255
- 255
- 255
- service: light.turn_on
data:
entity_id: light.heidi_nightstand
brightness_pct: 50
rgb_color:
- 255
- 255
- 255
- service: light.turn_on
data:
entity_id: light.downstairs_hallway
brightness_pct: 100
- alias: Crawl Space Button
initial_state: true
trigger:
platform: mqtt
topic: sonoff_bridge/crawlspace
payload: toggle
action:
- service: light.toggle
data:
entity_id: light.crawlspace
- alias: Downstairs Hallway Nightlight Mode
initial_state: true
trigger:
platform: time
at: input_datetime.downstairshallwaynightlight
condition:
condition: state
entity_id: group.bedtimephones
state: home
action:
- service: light.turn_on
data:
entity_id: light.downstairs_hallway
brightness_pct: 3
- alias: Downstairs Hallway Reset
initial_state: true
trigger:
platform: state
entity_id: light.downstairs_hallway
from:
- unknown
- unavailable
to: 'on'
condition:
condition: time
after: 07:00:00
before: '19:45:00'
action:
- service: light.turn_on
data:
entity_id: light.downstairs_hallway
brightness_pct: 100
- alias: Downstairs Hallway Turn Off
initial_state: true
triggers:
- trigger: mqtt
topic: zigbee2mqtt/Aqara Button 1/action
payload: single
- trigger: mqtt
topic: zigbee2mqtt/Aqara Button 2/action
payload: single
conditions:
- '{{ is_state(''light.downstairs_hallway'', ''on'') }}'
action:
- service: light.turn_off
target:
entity_id: light.downstairs_hallway
- alias: Downstairs Hallway Turn On Daytime
initial_state: true
triggers:
- trigger: mqtt
topic: zigbee2mqtt/Aqara Button 1/action
payload: single
- trigger: mqtt
topic: zigbee2mqtt/Aqara Button 2/action
payload: single
conditions:
- and:
- '{{ is_state(''light.downstairs_hallway'', ''off'') }}'
- condition: time
after: input_datetime.boys_room_morning
before: input_datetime.downstairshallwaynightlight
action:
- service: light.turn_on
target:
entity_id: light.downstairs_hallway
data:
brightness: 255
- alias: Downstairs Hallway Turn On Nighttime
initial_state: true
triggers:
- trigger: mqtt
topic: zigbee2mqtt/Aqara Button 1/action
payload: single
- trigger: mqtt
topic: zigbee2mqtt/Aqara Button 2/action
payload: single
conditions:
- and:
- '{{ is_state(''light.downstairs_hallway'', ''off'') }}'
- condition: time
after: input_datetime.downstairshallwaynightlight
before: input_datetime.boys_room_morning
action:
- service: light.turn_on
target:
entity_id: light.downstairs_hallway
data:
brightness: 8
- alias: Garage AC Set Morning
initial_state: false
trigger:
platform: time
at: input_datetime.workday_start
condition:
- condition: state
entity_id: climate.garage_hvac
state: cool
action:
- service: climate.set_temperature
data_template:
entity_id: climate.garage_hvac
temperature: "{% if(is_state('group.thermostatdevices', 'home') and is_state('binary_sensor.workday_sensor',\
\ 'on')) %}\n {{ states('input_number.garage_ac_set_point_low') }}\n{% else\
\ %}\n {{ states('input_number.garage_ac_set_point_high') }}\n{% endif %}\n"
- alias: Garage AC Set Night
initial_state: false
trigger:
platform: time
at: input_datetime.workday_end
condition:
- condition: state
entity_id: climate.garage_hvac
state: cool
action:
- service: climate.set_temperature
data_template:
entity_id: climate.garage_hvac
temperature: "{% if(is_state('group.thermostatdevices', 'home') and is_state('binary_sensor.workday_sensor',\
\ 'on')) %}\n {{ states('input_number.garage_ac_set_point_high') }}\n{% else\
\ %}\n {{ states('input_number.garage_ac_set_point_high') }}\n{% endif %}\n"
- alias: Garage Heat Set Morning
initial_state: false
trigger:
platform: time
at: input_datetime.workday_start
condition:
- condition: state
entity_id: climate.garage_hvac
state: heat
action:
- service: climate.set_temperature
data_template:
entity_id: climate.garage_hvac
temperature: "{% if(is_state('group.thermostatdevices', 'home') and is_state('binary_sensor.workday_sensor',\
\ 'on')) %}\n {{ states('input_number.garage_ac_set_point_high') }}\n{% else\
\ %}\n {{ states('input_number.garage_ac_set_point_low') }}\n{% endif %}\n"
- alias: Garage Heat Set Night
initial_state: false
trigger:
platform: time
at: input_datetime.workday_end
condition:
- condition: state
entity_id: climate.garage_hvac
state: heat
action:
- service: climate.set_temperature
data_template:
entity_id: climate.garage_hvac
temperature: "{% if(is_state('group.thermostatdevices', 'home') and is_state('binary_sensor.workday_sensor',\
\ 'on')) %}\n {{ states('input_number.garage_ac_set_point_low') }}\n{% else\
\ %}\n {{ states('input_number.garage_ac_set_point_low') }}\n{% endif %}\n"
- alias: Heidi Nightstand Failsafe Off
initial_state: true
trigger:
platform: time
at: 03:00:00
action:
- service: light.turn_off
entity_id: light.heidi_nightstand
- alias: AC Set Away
initial_state: true
trigger:
platform: state
entity_id: group.thermostatdevices
from: home
to: not_home
condition:
- condition: state
entity_id: climate.thermostat
state: cool
action:
- service: climate.set_temperature
data_template:
entity_id: climate.thermostat
temperature: "{% if '07:30' <= states('sensor.time') < '22:00' %}\n {{ states('input_number.ac_set_point_away_day')\
\ }}\n{% else %}\n {{ states('input_number.ac_set_point_away_night') }}\n\
{% endif %}\n"
- alias: AC Set Home
initial_state: true
trigger:
platform: state
entity_id: group.thermostatdevices
from: not_home
to: home
condition:
- condition: state
entity_id: climate.thermostat
state: cool
action:
- service: climate.set_temperature
data_template:
entity_id: climate.thermostat
temperature: "{% if '07:30' <= states('sensor.time') < '22:00' %}\n {{ states('input_number.ac_set_point_home_day')\
\ }}\n{% else %}\n {{ states('input_number.ac_set_point_home_night') }}\n\
{% endif %}\n"
- alias: AC Set Morning
initial_state: true
trigger:
platform: time
at: input_datetime.climate_morning
condition:
- condition: state
entity_id: climate.thermostat
state: cool
action:
- service: climate.set_temperature
data_template:
entity_id: climate.thermostat
temperature: "{% if is_state('group.thermostatdevices', 'home') %}\n {{ states('input_number.ac_set_point_home_day')\
\ }}\n{% else %}\n {{ states('input_number.ac_set_point_away_day') }}\n{%\
\ endif %}"
- alias: AC Set Night
initial_state: true
trigger:
platform: time
at: input_datetime.climate_night
condition:
- condition: state
entity_id: climate.thermostat
state: cool
action:
- service: climate.set_temperature
data_template:
entity_id: climate.thermostat
temperature: "{% if is_state('group.thermostatdevices', 'home') %}\n {{ states('input_number.ac_set_point_home_night')\
\ }}\n{% else %}\n {{ states('input_number.ac_set_point_away_night') }}\n\
{% endif %}\n"
- alias: Heat Set Away
initial_state: true
trigger:
platform: state
entity_id: group.thermostatdevices
from: home
to: not_home
condition:
- condition: state
entity_id: climate.thermostat
state: heat
action:
- service: climate.set_temperature
data_template:
entity_id: climate.thermostat
temperature: "{% if '07:30' <= states('sensor.time') < '22:00' %}\n {{ states('input_number.heat_set_point_away_day')\
\ }}\n{% else %}\n {{ states('input_number.heat_set_point_away_night') }}\n\
{% endif %}\n"
- alias: Heat Set Home
initial_state: true
trigger:
platform: state
entity_id: group.thermostatdevices
from: not_home
to: home
condition:
- condition: state
entity_id: climate.thermostat
state: heat
action:
- service: climate.set_temperature
data_template:
entity_id: climate.thermostat
temperature: "{% if '07:30' <= states('sensor.time') < '22:00' %}\n {{ states('input_number.heat_set_point_home_day')\
\ }}\n{% else %}\n {{ states('input_number.heat_set_point_home_night') }}\n\
{% endif %}\n"
- alias: Heat Set Morning
initial_state: true
trigger:
platform: time
at: input_datetime.climate_morning
condition:
- condition: state
entity_id: climate.thermostat
state: heat
action:
- service: climate.set_temperature
data_template:
entity_id: climate.thermostat
temperature: "{% if is_state('group.thermostatdevices', 'home') %}\n {{ states('input_number.heat_set_point_home_day')\
\ }}\n{% else %}\n {{ states('input_number.heat_set_point_away_day') }}\n\
{% endif %}\n"
- alias: Heat Set Night
initial_state: true
trigger:
platform: time
at: input_datetime.climate_night
condition:
- condition: state
entity_id: climate.thermostat
state: heat
action:
- service: climate.set_temperature
data_template:
entity_id: climate.thermostat
temperature: "{% if is_state('group.thermostatdevices', 'home') %}\n {{ states('input_number.heat_set_point_home_night')\
\ }}\n{% else %}\n {{ states('input_number.heat_set_point_away_night') }}\n\
{% endif %}\n"
- alias: Kids Button
initial_state: true
trigger:
platform: mqtt
topic: zigbee2mqtt/Kid's Button/action
payload: single
action:
- service: script.boys_room_ceiling
data:
button: kids_button
- alias: Master Button
initial_state: true
trigger:
platform: mqtt
topic: zigbee2mqtt/Master Button/action
payload: single
action:
- service: script.boys_room_ceiling
data:
button: master_button
- alias: Outside Lights Morning Off
initial_state: true
trigger:
- platform: sun
event: sunrise
offset: +00:30:00
action:
- service: switch.turn_off
target:
entity_id: switch.in_wall_toggle_switch_qfsw_500s
- alias: Outside Lights Nightime On
initial_state: true
trigger:
- platform: sun
event: sunset
offset: -00:30:00
action:
- service: switch.turn_on
target:
entity_id: switch.in_wall_toggle_switch_qfsw_500s
- alias: Reset Heidi's bedroom light
initial_state: true
trigger:
platform: time
at: input_datetime.resetlights
condition:
- and:
- condition: state
entity_id: group.bedtimephones
state: home
- condition: state
entity_id: light.heidi_nightstand
state: 'on'
action:
- service: light.turn_on
data:
entity_id: light.heidi_nightstand
brightness_pct: 30
rgb_color:
- 0
- 0
- 255
- alias: Reset Shaun's bedroom light
initial_state: true
trigger:
platform: time
at: input_datetime.resetlights
condition:
- and:
- condition: state
entity_id: group.bedtimephones
state: home
- condition: state
entity_id: light.shaun_nightstand
state: 'on'
action:
- service: light.turn_on
data:
entity_id: light.shaun_nightstand
brightness_pct: 30
rgb_color:
- 0
- 0
- 255
- alias: Ring Ding Download
initial_state: true
trigger:
- platform: state
entity_id: event.front_door_ding
from: 'off'
to: 'on'
action:
- delay: 300
- service: downloader.download_file
data:
url: '{{ state_attr(''camera.front_door_2'', ''video_url'') }}'
subdir: press
filename: '{{ now().strftime(''%H-%M-%S'') }}.mpg'
- alias: Ring Motion Download
initial_state: true
trigger:
- platform: state
entity_id: event.front_door_motion
from: 'off'
to: 'on'
action:
- delay: 300
- service: downloader.download_file
data:
url: '{{ state_attr(''camera.front_door_2'', ''video_url'') }}'
subdir: motion
filename: '{{ now().strftime(''%H-%M-%S'') }}.mpg'
- alias: Power state on HA start-up
trigger:
platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: sonoffs/cmnd/state
payload: ''
- alias: Water Garden
initial_state: true
trigger:
platform: time
at: input_datetime.gardenwatertime
conditions: '{{ states(''sensor.unknown_device_soilmoisture1'') | int <= states(''input_number.garden_soil_moisture_level'')
| int and (states(''sensor.openweathermap_condition'') != ''pouring'' and states(''sensor.openweathermap_condition'')
!= ''rainy'' and states(''sensor.openweathermap_condition'') != ''snowy-rainy'')
}}'
actions:
- action: number.set_value
target:
entity_id: number.garden_sprinkler_irrigation_target
data:
value: '{{ states(''input_number.length_of_time_to_water_the_garden'') | int
* 60 }}'
- delay:
seconds: 5
- action: switch.turn_on
data:
entity_id: switch.garden_sprinkler_state