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.
Thanks

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.

I’m seeing as well for the past couple nights. ALL the lights turn on around 1:50am and go off 4 minutes later. It’s both Zooz switches as well as various Zigbee bulbs and a pair of WiFi bulbs.

I found this interesting crumb:

2024-10-15 01:50:07.476 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.vacation_lights, brightness_step_pct=-7>

and then I see all the lights in the Vacation Lights Group turning on, and then off again 4 minutes later. Vacation Lights group is part of the Presence Simulator integration.

But, what’s triggering the vacation lights group to turn on?
Now just before the service call to turn on Vacation Lights, i see an entry from Alexa:

2024-10-15 01:50:07.185 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event alexa_smart_home[L]: request=namespace=Alexa, name=ReportState, entity_id=light.vacation_lights, response=namespace=Alexa, name=StateReport>

is it possible that the Alexa request for state triggered it on?

I see the same thing the night before:

2024-10-14 02:01:45.448 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event alexa_smart_home[L]: request=namespace=Alexa, name=ReportState, entity_id=light.vacation_lights, response=namespace=Alexa, name=StateReport>

2024-10-14 02:01:45.792 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.vacation_lights, brightness_step_pct=-4>

2024-10-14 02:01:45.792 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light,
service=turn_on,
service_data=brightness=29,
entity_id=[
 'light.center_island',
 'light.foyer_chandelier',
 'light.kitchen_spots',
 'light.hallway_lamp_level_on_off',
 'light.living_room_lamp_light',
 'light.lr_sconces',
 'light.lr_spots',
 'light.stairs',
 'light.chandelier'
]>

Then @ 2:04:50, I see this from Alexa:

2024-10-14 02:04:50.971 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event alexa_smart_home[L]: request=namespace=Alexa.PowerController, name=TurnOff, entity_id=light.vacation_lights, response=namespace=Alexa, name=Response>

2024-10-14 02:04:50.984 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_off, service_data=entity_id=['light.living_room_left_sconce', 'light.living_room_right_sconce']>

And as expected, all those lights turn off. I have no Alexa routines to account for this behavior.