#Automations using sunrise/sunset not triggering
1 messages · Page 1 of 1 (latest)
Here's the automation code:
id: '1755516189591'
alias: Turn porch light on when motion detected after hours
description: ''
triggers:
- type: motion
device_id: 49e3c4e51eab11eb89eebbd6c6af6baa
entity_id: e2c87c3a6796e2b0fee0766dd3340e97
domain: binary_sensor
trigger: device
conditions:
- condition: sun
before: sunrise
after: sunset
actions:
- type: turn_on
device_id: e1c54d37ec3beb5c37a4a78e13bbf74e
entity_id: 2c5789b6fd8640ff0023be065eb9770b
domain: switch
mode: single
you forgot the closing code tags 🙂
I have a very similar setup. The YAML looks about the same? Maybe verify the motion sensor is happy and still detecting?
description: ""
triggers:
- type: motion
device_id: 91f96825c5891d8aac0778b398701856
entity_id: 1cb5e3a5377ad37c046e5fdc82300fc4
domain: binary_sensor
trigger: device
conditions:
- condition: sun
after: sunset
before: sunrise
actions:
- action: switch.turn_on
metadata: {}
target:
entity_id: switch.driveway_lights
data: {}
mode: single```
I set up a dining room light with two separate automations for on and off, with offset from sun state:
alias: turn-on-one-hour-pre-sunset
description: ""
triggers:
- trigger: sun
event: sunset
offset: "-01:00:00"
conditions: []
actions:
- type: turn_on
device_id: ff8912eda118b2348f7a9dd61295466b
entity_id: ecdce6bda91d74a6d954e1d714e3f2c9
domain: switch
mode: single
Mine triggers on the sun state offset instead of just as a condition on a different trigger though
I have another automation that is sunrise/sunset that isn't working, and it's literally just a "If light is off, turn it on at sunset" and "if light is on, turn off at sunrise"
And it's not working either
Like, here, we can see that I'm in "sunrise"
But this never fired:
This uses a Ring camera and a Meross WiFi light switch, and a Meross plug.
I have another Meross plug that operates on specific times, and that one is working, which leads me to believe that the Meross integration seems to be fine.
It appears to be just strictly the sunrise/sunset options that are misbehaving
Last time I had an issue with an integration not firing, I restarted HA and it fixed it, heh (might be worth a try)
Was one of the first things I tried when the issue popped up
so the question is: is it not firing, or is the condition not letting it pass through? click the dots in the top right corner and check the Traces
I'm less familiar with troubleshooting in traces, so you'll need to be patient with me there:
no that's fine... that's really weird though because 20:37:08 is definitely before 23:44:59...
Indeed.
That's why I'm here
also... where are you that sunset is 15 mins before midnight in March!?
I'm in Florida.
So, now I'm questioning whether or not this is even tracking time properly at all
As noted in an image higher up, the next sunset is expected around 7:46
ah no, that should be correct then, as the timestamp will be in UTC and y'all are at UTC-4
in which case it's working correctly to not run after 7:47, no?
No, because it should be turning the light off after sunrise, but before sunset
So, the fact that it's trying to execute at 8:37pm is likely part of the problem
I think I see the issue
I think I got my triggers and conditions backwards
Well, on THIS one anyways
The issue with the motion sensor automation is still a problem
what's the issue with that?
The automation is supposed to be "If motion detected in driveway, between sunset and sunrise, turn on porch light", but it seems like despite the motion being detected, it's not turning on the light.
ok, but the condition is set to be between sunrise and sunset?
Yes
so swap it round, then it should work
Not on the camera, sorry
Camera is set up properly.
But in digging into it further, it's possible that the camera is not firing the motion detected sensor to Home Assistant properly.
Starting to wonder if it's Ring's fault.
They recently gave me a 14 day trial of their stupid AI motion describer thingy
ah ok, well - check the traces, that will help you differentiate between "the trigger is failing" and "the condition is behaving weirdly"
Trace isn't showing anything because the thing appears to have stopped working on the 23rd of March
Hasn't fired since, because I think the motion events aren't coming through
yeah, if there are no traces, the trigger isn't occurring, likely a ring thing
Yeah, I'm starting to lean towards Ring.
I'm looking at the other devices, and they all seemed to stop firing motion detection events on the 23rd
then you should finish leaning towards ring
It's weird. The "Last motion activity" sensor is working
But the "Motion detected itself" is broken
hmm
try changing to a state trigger based on that "last motion activity" sensor then
It's a short driveway, that'll turn the light on after Amazon drops the packages off, versus while they're wlaking up
ok, but if the data isn't there you've got to make do with what you've got
I think it's related tot his:
https://www.home-assistant.io/integrations/ring/
There's a spot in there saying that after a 2023 update if you have too many authorized devices motion detection may not work properly, so you need to clear out the authorized devices.
I'm starting to suspect that after each Home Assistant update it was registering with Ring as a new device, and I may have hit my "limit"
Yes
That appears to have fixed it
FFS, what a stupid bug
Just to close the loop