How to tell what caused an action

So, I am trying to find out what is causing specific actions.
Every now and then my bathroom light turns on for example… I don’t remember any automation or node-red trigger I used to cause it to turn on except for the motion sensor.
I can trade back the light turning on to the always helpful “turned on triggered by service light.turn_on” but what caused home assistant to turn it on? I need to track it down to the automation or the node-red flow that did it. There has to be a way, but I can’t find it.
Thanks in advance.

I am having the same issue, random lights turn on randomly but there is not enough detail in the logbook to see what automation turned them on?? It seems that all the lights are tied back to the localtuya integration and triggered by the service light.turn_on. Anyone lend some tips?? I am newly learning this HA thing.

Welcome to the forum, Anj-0110 :wave:t3:

Its not a HA error but this is mostly caused by the switches themselves. According to my experiences this happens with some (but not all) cheap “no neutral line, no capacitor needed” Tuya smart switches. With some switches it helps to simply add a capacitor.

I added automations to switch off those switches after a certain time but eventually replaced them with better ones (preferably Zigbee based switches).

Thanks for the reply Tamsy.

I don’t have tuya switches, the lights are wired into a normal (non-smart) on/off switch that stays on all the time. The light fixtures themselves are tuya devices.

How do I track down what automation turned them on? I have noticed in the log that I have localtyua warnings, something else might be taking place just not sure how to troubleshoot it. Looking through all the forums and posts to see what I can learn.

Any updates on this? Early this morning my bedroom hue lights turned on at 0245 for no reason, and my Bond bridge controlled ceiling fan turned off at the same time. The commands came from home assistant but I can’t figure out why! The logs show the events but now what the triggers were. Help!!

I am still waiting for help on this as well. The devices running through tuya cycle erratically and then sometimes it will go for hours without a phantom “on” cycle.

Update, I figured out my own issue - it was the Hue bridge, which auto-updated in the morning and when it came back online HA ‘triggered’ button presses from the tap dial switches that I have. It’s posted on the Hue forum and my solution was to move the Hue bridge auto-update time to the middle of the day simply so if it happens again I can just turn the lights off without waking up.