Hi all,
Google translated text…
I made an automation to switch on my lights in the house and garden if someone opens the garden door after sunset. The lights will then stay on for 15 minutes when they turn off automatically. Set as condition that no lights are turned on in the house. An email will also be sent.
The automation calls a script and from the script a scene is started as shown in the example. This all works perfectly but I wonder if it could all be a little simpler.
Automation
- alias: '#003a Turn on lights on opening gardendoor”
trigger:
- entity_id: binary_sensor.gardendoor
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
- condition: state
entity_id: light.livingroom_all_lights
state: 'off'
- before: 05:00
condition: time
action:
- service: script.turn_on
target:
entity_id: script.1595314230803
- service: notify.automation_notification
data:
message: Someone entering garden!
title: garden door has been opened!
mode: single
Script
alias: Turn on lights on opening gardendoor
sequence:
- service: scene.turn_on
target:
entity_id: scene.lights_30_gardendoor_open_after_sunset
metadata: {}
- delay:
hours: 0
minutes: 15
seconds: 0
milliseconds: 0
- data: {}
entity_id: light.to_sleep
service: light.turn_off
mode: single
Scene
- id: '1595314000859'
name: lights 30 % gardendoor open after sunset
entities:
light.light_garage_left:
supported_color_modes:
- brightness
color_mode: brightness
brightness: 76
mode: normal
dynamics: none
friendly_name: Light garage left
supported_features: 40
state: 'on'
light.porch_left:
supported_color_modes:
- brightness
color_mode: brightness
brightness: 76
mode: normal
dynamics: none
friendly_name: Porch left
supported_features: 40
state: 'on'
etc.. etc..