I’m going round in circles calling one script to fire another which in turn fires another. There must be an easier way. From the code below, I’m trying to make the - service: script.notify_engine
only fire if I’m not home.
automation:
- alias: 'Notify Pool Gate Open'
initial_state: true
trigger:
platform: state
entity_id: binary_sensor.door_window_sensor_pool_gate ##
from: 'off'
to: 'on'
for:
seconds: 02
action:
- service: rest_command.move_to_preset_02_07s
- service: rest_command.trigger_pool_deck_15s ## Records camera for 15s ##
- delay: '00:00:03'
- service: camera.snapshot
data:
entity_id: camera.pool_deck
filename: '/config/www/images/pool_gate.jpg'
- service: script.notify_engine
data_template:
message: "Pool Gate was opened"
file_url: http://10.0.1.200:8123/local/images/pool_gate.jpg
- service: notify.kodi
data:
title: "Home Assistant"
message: "The Pool Gate opened at {{ states.sensor.time.state }}"
data:
displaytime: 5000
I know I can use a service_template
to determine if I’m not_home
and then fire s script from that but I was getting to four scripts deep to make this happen before I pulled the eject pin.
I want to mostly use the - service: script.notify_engine
code in my notifiers but with an easy way of making some of them conditional on my home/away status. At the moment my phone is going crazy all day long as gates are being opened and I only want this happening when I’m away (or possibly when the alarm is set).
Any help would be appreciated.