Unwanted delay in home assistant call service node, fast switching not possible?

I have this fairly basic setup, consisting of a switch that I use to control a light. The switch triggers a events:state node, a switch node checks which button was pushed, and it sends a trigger to a call:service node.

This works, up to a point. I can't seem to switch the light on and off immediately after switching it on (and vice versa). I always have to wait 15-20 seconds before the call:service node will actually do anything again. The strange part is that, when I put a debug node after the call service node, it registeres the quick succession between clicks. So the call:service node isn't 'busy' or anything, it just doesn't physically switch anything. To be clear: this happens with several switches (Xiaomi and other brands), and with both my Shellies and several brands of smart bulbs.

I'm fairly new to Node-Red, but is there something in the call:service node that I'm not seeing? Like a anti-bounce/rate limiting mechanism of some sort?
Any help would be greatly appreciated!

I would guess (since you didn't put debug nodes everywhere on your screenshot for us to see the output) that either somehow you are sending multiple on & off in succession. Or the node/service had a deliberate anti-repeat/de-bounce to "help you"

You're right, sorry! I included the debug nodes:

The wall switch indeed seems to send an empty string into the process. But I'm not sure if that's the issue here, since I can click it again right after clicking the first time, and it will send another message into the flow:

In the second image, you can see that I'm clicking the button 1 second later. The call:service node responds with light.toggle called at: April 12, 11:02 even though the physical light did not toggle. I can keep clicking the button, and after 20 seconds or so the light will eventually toggle.

I've included the export of the flow, should that be helpful:

[{"id":"fe972f0b.5e0eb","type":"tab","label":"Test","disabled":false,"info":""},{"id":"cbfd5733.975038","type":"server-state-changed","z":"fe972f0b.5e0eb","name":"Double key switch","server":"3ecfd5ab.de166a","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.0x00158d0002b4a074_click","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":130,"y":140,"wires":[["6ef37698.e06ef8","58fe02da.179d5c"]]},{"id":"6ef37698.e06ef8","type":"switch","z":"fe972f0b.5e0eb","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"left","vt":"str"},{"t":"eq","v":"right","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":230,"y":240,"wires":[["a6b14158.d555b","17cc9072.ac71a"],["dec4ee1b.58ba4"]]},{"id":"58fe02da.179d5c","type":"debug","z":"fe972f0b.5e0eb","name":"DK wall switch","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":370,"y":120,"wires":[]},{"id":"a6b14158.d555b","type":"api-call-service","z":"fe972f0b.5e0eb","name":"Light 1","server":"3ecfd5ab.de166a","version":1,"debugenabled":false,"service_domain":"light","service":"toggle","entityId":"light.shelly_shrgbw2_6ee67e","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":410,"y":200,"wires":[["3692a542.0ba66a"]]},{"id":"dec4ee1b.58ba4","type":"api-call-service","z":"fe972f0b.5e0eb","name":"Light 2","server":"3ecfd5ab.de166a","version":1,"debugenabled":false,"service_domain":"light","service":"toggle","entityId":"light.shelly_shrgbw2_6ee67e","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":408,"y":274,"wires":[[]]},{"id":"17cc9072.ac71a","type":"debug","z":"fe972f0b.5e0eb","name":"Switch","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":220,"y":400,"wires":[]},{"id":"3692a542.0ba66a","type":"debug","z":"fe972f0b.5e0eb","name":"Light 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":600,"y":200,"wires":[]},{"id":"3ecfd5ab.de166a","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.