67 lines
3.1 KiB
YAML
67 lines
3.1 KiB
YAML
|
# The following script runs when no one is home. It excludes some lights
|
||
|
# and switches like front porch and backyard lights...etc for safety reasons.
|
||
|
###############################################################################
|
||
|
homeassistant:
|
||
|
customize:
|
||
|
script.all_indoor_lights_off:
|
||
|
friendly_name: All Indoor Lights & Switches OFF
|
||
|
|
||
|
script:
|
||
|
|
||
|
home_mode_away:
|
||
|
sequence:
|
||
|
- service: script.all_indoor_lights_off
|
||
|
- service: input_boolean.turn_on
|
||
|
entity_id: input_boolean.notify_camera_motion
|
||
|
- service: climate.set_away_mode
|
||
|
data:
|
||
|
entity_id: climate.dining_room
|
||
|
away_mode: 'true'
|
||
|
- service: alarm_control_panel.alarm_arm_away
|
||
|
data:
|
||
|
entity_id: alarm_control_panel.simplisafe
|
||
|
- service: script.notify_me
|
||
|
data:
|
||
|
message: >
|
||
|
No one is at home. Cameras rolling, Indoor lights OFF, Thermostat is set to 'away' and your home is secured!
|
||
|
- service: camera.snapshot
|
||
|
data_template:
|
||
|
entity_id: "camera.kitchen_camera"
|
||
|
filename: "/home/homeassistant/.homeassistant/www/downloads/camera/kitchen/kitchen_away.jpg"
|
||
|
- service: camera.snapshot
|
||
|
data_template:
|
||
|
entity_id: "camera.frontroom_camera"
|
||
|
filename: "/home/homeassistant/.homeassistant/www/downloads/camera/frontroom/frontroom_away.jpg"
|
||
|
- service: notify.notify_smtp
|
||
|
data_template:
|
||
|
title: 'Indoor Pictures {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
||
|
message: 'No one seem to be home at the moment... Please see the images and make sure everything is okay.'
|
||
|
data:
|
||
|
images:
|
||
|
- "/home/homeassistant/.homeassistant/www/downloads/camera/kitchen/kitchen_away.jpg"
|
||
|
- "/home/homeassistant/.homeassistant/www/downloads/camera/frontroom/frontroom_away.jpg"
|
||
|
|
||
|
all_indoor_lights_off:
|
||
|
sequence:
|
||
|
- service: light.turn_off
|
||
|
data_template:
|
||
|
entity_id: >
|
||
|
{%- for state in states.light if state.entity_id != 'light.gateway_light_34ce008ad65d' -%}
|
||
|
{{- "," if not loop.first-}}{{ state.entity_id }}{{-endif-}}
|
||
|
{%- endfor -%}
|
||
|
- service: switch.turn_off
|
||
|
data_template:
|
||
|
entity_id: >
|
||
|
{%- for state in states.switch if
|
||
|
state.entity_id != 'switch.wemoswitch1' and
|
||
|
state.entity_id != 'switch.wallmote_switch' and
|
||
|
state.entity_id != 'switch.wemobackyardlightswitch' and
|
||
|
state.entity_id != 'switch.frontyard_light' and
|
||
|
state.entity_id != 'switch.dockermon' and
|
||
|
state.entity_id != 'switch.grafana' and
|
||
|
state.entity_id != 'switch.influxdb' and
|
||
|
state.entity_id != 'switch.home_bridge' and
|
||
|
state.entity_id != 'switch.rf_switch_five' and
|
||
|
not '_siren_' in state.entity_id -%}
|
||
|
{{- "," if not loop.first-}}{{ state.entity_id }}{{-endif-}}
|
||
|
{%- endfor -%}
|