My Automation is the following a little modified for my belongings:
blueprint:
name: Door Sensor-activated Light
description: Turn on a light when door is opened.
domain: automation
input:
doorsensor_entity:
name: Door Sensor
selector:
entity:
domain: binary_sensor
switch_target:
name: Schalter
selector:
target:
entity:
domain: switch
door_closed_wait:
name: Wait time
description: Time to leave the light on after door is closed
default: 360
selector:
number:
min: 0.0
max: 10.0
unit_of_measurement: minutes
step: 1.0
mode: slider
source_url: https://community.home-assistant.io/t/door-sensor-turn-on-off-light/255657
mode: single
max_exceeded: silent
trigger:
platform: state
entity_id: !input 'doorsensor_entity'
from: 'off'
to: 'on'
condition: []
# I have no f... idea what to type here ;-) I have tried so many...
action:
- service: switch.turn_on
target: !input 'switch_target'
- wait_for_trigger:
platform: state
entity_id: !input 'doorsensor_entity'
from: 'on'
to: 'off'
- delay: !input 'door_closed_wait'
- service: switch.turn_off
target: !input 'switch_target'
The Conditions that i tried are the following:
condition:
- condition: sun
after: sunset
before: sunrise
before_offset: '02:00:00'
condition:
- condition: sun
after: sunset
before: sunrise
before_offset: '"02:00:00"
condition:
- condition: sun
after: sunset
before: sunrise
before_offset: '02:00:00'
condition:
condition: and
conditions:
- condition: sun
after: sunset
- before: sunrise
before_offset: "02:00:00"
condition:
condition: and
conditions:
- condition: sun
after: sunset
- condition: sun
before: sunrise
before_offset: "-02:00:00"
Can somebody pls help me with the correct way to do this. Im getting more and more frustrated.
turn on light (if light: off, after sunset and before sunrise) - trigger state “door open” on - action “switch.turn.on”
2, turn off light ( if lights “on” and door “closed”, wait …) trigger state “door closed” off - action switch.turn.off
Havent tried this, but i decided to have 2 “simple” automatons for light under my bed(no wait time, because my motin-sensor give me time i need) … i.e you dont need the sun(state) in “turn-off-light” automation, as it’s never on during day-time, cording to “turn-on-light” automation
Don’t even think you need the “door closed” in conditions for 2nd automation, as it’s triggered by the “door closed” state
PS: I Just realized i had “sun” as trigger, and “motion detected” as condition … so <wrong i looked a another simple switch on/off , event sunrise/event sunset … and the one with sun as condition and motion trigger i use below horison … there are varies ways to accomplice a simple, the same … some might work, but throwing warnings, if executed while ongoing “wait time” is running
He should ditch above “blueprint” , start from scratch cording to his own “credentials” and devices, … “From > To” seems like the condition in the orig blueprint, then adding any “sun” condition to the whole equation might not make any sense
@MaxGroh Another “Blueprint” you can look into ( until you decide to test your own skills, in automation-UI )