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

**URL:** https://discourse.nodered.org/t/unwanted-delay-in-home-assistant-call-service-node-fast-switching-not-possible/24683
**Category:** General
**Created:** [12 April 2020 08:23 UTC](https://discourse.nodered.org/t/unwanted-delay-in-home-assistant-call-service-node-fast-switching-not-possible/24683 "2020-04-12T08:23:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dirktheman](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dirktheman/32/19820_2.png) [@dirktheman](https://discourse.nodered.org/u/dirktheman)
#### Post date: [12 April 2020 08:23 UTC](https://discourse.nodered.org/t/unwanted-delay-in-home-assistant-call-service-node-fast-switching-not-possible/24683/1 "2020-04-12T08:23:14Z")

</div>

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!

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/e/5e829563cc95eb6b4cfd87c35cf0d593fa1aedf0.png)

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [12 April 2020 08:29 UTC](https://discourse.nodered.org/t/unwanted-delay-in-home-assistant-call-service-node-fast-switching-not-possible/24683/2 "2020-04-12T08:29:11Z")

</div>

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"

---

<div class="post-metadata">

### Author: ![dirktheman](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dirktheman/32/19820_2.png) [@dirktheman](https://discourse.nodered.org/u/dirktheman)
#### Post date: [12 April 2020 09:06 UTC](https://discourse.nodered.org/t/unwanted-delay-in-home-assistant-call-service-node-fast-switching-not-possible/24683/3 "2020-04-12T09:06:05Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/4/74a047c58cde6f4876c43c8df485767d81ecf167.png)

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:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e812dc1742c04f94141faa5d0cdb4d8d3d3d0c90.png)

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:

```auto
[{"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}]

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [11 June 2020 09:06 UTC](https://discourse.nodered.org/t/unwanted-delay-in-home-assistant-call-service-node-fast-switching-not-possible/24683/4 "2020-06-11T09:06:08Z")

</div>

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