Node red - randomly triggered within a flow

Hey community,

Some of my lights in my home randomly turn on during the night and the state history shows me that supervisor turned them on.
Since I do most of my automations via node red I checked which flow might have turned my lights on and found the following:

The weird thing is that the flow seems to have been triggered not by the first (change-state)node but somehow within the node by itself.

The flow checks the brightness and color of the light when it is turned on and changes these parameters fluently to a target brightness and color depending on the time.

[{"id":"94dc2b000c4b6a15","type":"function","z":"c752bb87ab83a96f","name":"","func":"var date = new Date();\nvar h = date.getHours();\nvar brightness = msg.data.new_state.attributes.brightness; \nvar brightness_end;\nvar color_temp = msg.data.new_state.attributes.color_temp;\nvar color_end;\n\nif(h < 8 || h > 21){\n    brightness_end = 100;\n    color_end = 400;\n    }\nif(h >= 8 && h <= 21){\n    brightness_end = 254;\n    color_end = 365;\n    }\n\nmsg =  {\n    payload:{  \n      \"data\":{  \n         \"brightness\":brightness,\n         \"brightness_end\":brightness_end,\n         \"color_temp\":color_temp,\n         \"color_end\":color_end\n      }\n   }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":1300,"wires":[["11c22efd4cb9f547","84e59f80fabece6e"]]},{"id":"f8fd17cb50f9301a","type":"server-state-changed","z":"c752bb87ab83a96f","name":"Wohnzimmerlicht geht an","server":"b6d11f36.79fbb","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.wohnzimmerlicht","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":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":150,"y":1300,"wires":[["94dc2b000c4b6a15"],[]]},{"id":"25d7233659b5c1f3","type":"change","z":"c752bb87ab83a96f","name":"Transition Message","rules":[{"t":"set","p":"transition","pt":"msg","to":"{\t   \"duration\": 5,\t   \"units\": \"Second\",\t   \"steps\": 15,\t   \"startMired\": payload.data.color_temp,\t   \"endMired\": payload.data.color_end,\t   \"startBright\": payload.data.brightness,\t   \"endBright\": payload.data.brightness_end,\t   \"brightnessType\": \"Integer\",\t   \"transitionType\": \"Linear\",\t   \"colorTransitionType\" : \"Weighted\"\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":1300,"wires":[["9c603a0a018b9475"]]},{"id":"9c603a0a018b9475","type":"light-transition","z":"c752bb87ab83a96f","name":"Transition","startRGB":"#ff0000","transitionRGB":"#ffc864","endRGB":"#ffffff","startMired":"","endMired":"","transitionTime":"5","transitionTimeUnits":"Second","steps":"15","startBright":"1","endBright":"100","brightnessType":"Percent","transitionType":"Linear","colorTransitionType":"Weighted","x":1080,"y":1300,"wires":[["4e209132e0abb385"],[]]},{"id":"4e209132e0abb385","type":"api-call-service","z":"c752bb87ab83a96f","name":"Wohnzimmerlicht an","server":"b6d11f36.79fbb","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.wohnzimmerlicht","data":"{\t   \"brightness\": payload.brightness,\t   \"color_temp\": payload.color_temp\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1280,"y":1300,"wires":[[]]},{"id":"11c22efd4cb9f547","type":"switch","z":"c752bb87ab83a96f","name":"Wärme gleich?","property":"payload.data.color_temp","propertyType":"msg","rules":[{"t":"eq","v":"payload.data.color_end","vt":"msg"},{"t":"neq","v":"payload.data.color_end","vt":"msg"}],"checkall":"true","repair":false,"outputs":2,"x":540,"y":1280,"wires":[[],["c2de30937df70823"]]},{"id":"84e59f80fabece6e","type":"switch","z":"c752bb87ab83a96f","name":"Helligkeit gleich?","property":"payload.data.brightness","propertyType":"msg","rules":[{"t":"eq","v":"payload.data.brightness_end","vt":"msg"},{"t":"neq","v":"payload.data.brightness_end","vt":"msg"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":1320,"wires":[[],["c2de30937df70823"]]},{"id":"c2de30937df70823","type":"delay","z":"c752bb87ab83a96f","name":"1 Msg","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"7","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":750,"y":1300,"wires":[["25d7233659b5c1f3"]]},{"id":"b6d11f36.79fbb","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]

Why does this happen and how can I solve this problem?

This is a trigger based if the light is turned on.
Is there an another flow triggering on something like PIR sensor switching on your light?

I dont use that light transition but I"d guess that node is continuing to increase or decrease the light after the light is turned off.

You are right. It seems like a different flow turned on my light.
I was able to narrow it down to an ikea zigbee dimmer switch that somehow by itself sent a turn on signal. I am not quite sure why but will look into it.