How do you figure out why a Toggling a Light On keeps turning on and off

hi
so i have a weird thing going on… a TPlink light switch…

i toggle it on from the dashboard and it will turn on… but then it will turn off a few seconds later then on then a few seconds off

some of the logs is showing

March 17, 2026
turned on
12:48:37 PM - Now
turned off
12:48:32 PM - 5 seconds ago
turned on
12:48:17 PM - 20 seconds ago
turned off
12:48:07 PM - 30 seconds ago
turned on
12:47:47 PM - 50 seconds ago
turned off
12:47:37 PM - 1 minute ago
turned on
12:47:27 PM - 1 minute ago
turned off
12:47:22 PM - 1 minute ago
turned on
12:47:02 PM - 2 minutes ago
turned off
12:46:57 PM - 2 minutes ago
turned on
12:44:07 PM - 5 minutes ago
turned off
12:44:02 PM - 5 minutes ago
turned on
12:43:07 PM - 6 minutes ago
turned off
12:43:02 PM - 6 minutes ago
turned on
12:41:47 PM - 7 minutes ago
turned off
12:41:42 PM - 7 minutes ago
turned on
12:41:22 PM - 7 minutes ago

it will eventually stay on or randomly later turn off

is there something i need to toggle or something to fix this issue?
now it used to never do that… is it something in one of the HA updates… that i need to fix that breaks this? its also a 3way switch… so not sure whats going on
is it a wifi thing that is happening?

but if your phsyically turn the light switch on no issues of turning on and off

Hello,
You would first need to share any automations that you have that try to control these lights. The problem is most likely there.

You can use the </> button like this… How to format your code in forum posts
OR… Here is an example of how to fix formatting from the site FAQ Page.
How to help us help you - or How to ask a good question.

i only have one automation in node red

[{"id":"7a05c8ff9a342ae7","type":"switch","z":"1378e93887bb0d10","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":100,"wires":[["4a97105a2093ba3d"],["63d6b3f051e52ab4"]]},{"id":"ea7c5316171c6f5e","type":"server-state-changed","z":"1378e93887bb0d10","name":"Basement Center Light Come On With 3way","server":"915baa48.9b1898","version":6,"outputs":1,"exposeAsEntityConfig":"","entities":{"entity":["switch.basement_lights_3way"],"substring":[],"regex":[]},"outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":100,"wires":[["7a05c8ff9a342ae7"]]},{"id":"4a97105a2093ba3d","type":"api-call-service","z":"1378e93887bb0d10","name":"Center Basement Light On","server":"915baa48.9b1898","version":7,"debugenabled":true,"action":"switch.turn_on","floorId":[],"areaId":[],"deviceId":[],"entityId":["switch.basement_center_light"],"labelId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":false,"domain":"switch","service":"turn_on","x":660,"y":60,"wires":[[]]},{"id":"63d6b3f051e52ab4","type":"api-call-service","z":"1378e93887bb0d10","name":"Center Basement Light Off","server":"915baa48.9b1898","version":7,"debugenabled":false,"action":"switch.turn_off","floorId":[],"areaId":[],"deviceId":[],"entityId":["switch.basement_center_light"],"labelId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":false,"domain":"switch","service":"turn_off","x":660,"y":120,"wires":[[]]},{"id":"915baa48.9b1898","type":"server","name":"Home Assistant","version":6,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":["y","yes","true","on","home","open"],"connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"d412ca81879af902","type":"global-config","env":[],"modules":{"node-red-contrib-home-assistant-websocket":"0.80.3"}}]

other then that no automation

so if i toggle the switch at the light itself no glitch

but when i toggle

switch.basement_lights_3way

then it causes the light to turn on and off also turns on and off the led on the light switch itself i noticed

but if i turn on the switch but actually pressing the button it doesnt start flicking on and off… and i not sure when this started if one of the HA updates buggered it up or what not

so i thinking maybe its a glitch in the tplink switch

i recently learned how to make a script that does like auto entities to be able to restart all my tplink devices instead of pressing 1 button… i hoping that if say i reboot tplink switchs once a week or day or month keep them running fine.

as its just this 1 switch that is acting up and its not acting up always… so i could made script manually enter every switch in to restart but i have one that does auto entities so thats a big help

so i hoping this issue doesnt reoccur as i couldnt figure out what the heck is going on … as it would keep turnin on off as you see on its own but sometimes it didnt… even checked for new firmware none yet…

so i figure have a script that reboots these will solve my problem… as i couldnt figure it out