You cant have a condition of âafter sunset and before sunriseâ on the same day. It needs to be âafter sunset or before sunriseâ on the same day:
condition:
condition: or
conditions:
- condition: sun
after: sunset
after_offset: "-00:45:00"
- condition: sun
before: sunrise
before_offset: "00:45:00"
Your 10 second delay is after the action in the second automation. Also it is not needed. Do it like this:
- id: '1577684225468'
alias: no motion living room light off
description: no motion living room lights off
trigger:
- platform: state
entity_id: binary_sensor.wyzesense_779b9111
to: 'off'
for:
seconds: 10
action:
- service: switch.turn_off
entity_id: switch.055551102cf432194111
I made the changes. I will see if it works tonight. I made this with the HA wizard
under configuration-auctions i used the drop downs and it made the code. I am guessing that its not working very well using that way of visual coding and that i am going to have to slowly learn how to just code it myself.
You may have to go into your profile (the round icon at the bottom of the sidebar) and enable advanced mode. Then Configuration side menu / Server control
I found it! Just like you said i had to turn on advanced mode.
So the on trigger is now working but the off timer is not. Any ideas?
- id: '1577684225468'
alias: motion non living room light off
description: motion non living room lights off
trigger:
- entity_id: binary_sensor.wyzesense_779b9111
platform: state
to: 'off'
for:
minuts: 10
condition: []
action:
- entity_id: switch.055551102cf432194111
service: switch.turn_off
So this time i am using the visual basic studio. Again i tried to set this up using the add automation wizard and i already had to make so many changes that it did wrong but i am missing something. Any ideas?
This is a wyze magnetic sensor, when tripped turns on a light. when the door closes its waits 5 min then turns off the light. Sorry to bother you again i cant find the issue.
- id: '1577845861147'
alias: Entry light on
description: turn on entry light for 5 min when door opens
trigger:
- entity_id: binary_sensor.wyzesense_779ba111
platform: state
to: 'open'
condition:
condition: or
conditions:
- condition: sun
after: sunset
after_offset: -00:45:00
- condition: sun
before: sunrise
before_offset: 00:45:00
action:
- alias: ''
data: {}
entity_id: switch.055551102cf432192111
service: switch.turn_on
- id: '1577846098902'
alias: entry light off
description: turn off after 5min
trigger:
- entity_id: binary_sensor.wyzesense_779ba111
platform: state
to: 'close'
for:
minutes: 5
condition: []
action:
- entity_id: switch.055551102cf432192111
service: switch.turn_off