# Issue with node-red-contrib-home-assistant-websocket "API-CALL-SERVICE"

**URL:** <https://discourse.nodered.org/t/issue-with-node-red-contrib-home-assistant-websocket-api-call-service/69005>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [13 October 2022 22:46 UTC](https://discourse.nodered.org/t/issue-with-node-red-contrib-home-assistant-websocket-api-call-service/69005 "2022-10-13T22:46:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andyp](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@andyp](https://discourse.nodered.org/u/andyp)\
**Post date:** [13 October 2022 22:46 UTC](https://discourse.nodered.org/t/issue-with-node-red-contrib-home-assistant-websocket-api-call-service/69005/1 "2022-10-13T22:46:09Z")

</div>

Interesting issue!

Using Home Assistant on a RPi and running Node-red for my automations. Using a ESP8266 running ESPHome to send some serial data. I am using [UART Switch — ESPHome](https://esphome.io/components/switch/uart.html) so very easy to set up.

```auto
uart:
  id: uart_bus
  tx_pin: GPIO1 #D3
  rx_pin: GPIO3 #D4
  baud_rate: 57600
  
switch:
  - platform: uart
    name: "Send_R"
    data: 'R'
  - platform: uart
    name: "Send_6"
    data: '6'
  - platform: uart
    name: "Send_4"
    data: '4' 

```

These switch entities are available in Home Assistant, and work exactly as expected. Turning the 'Send\_4' switch on sends '4'. Great so far! So ESPHome is working as expected and Home Assistant is as expected.

The problem is in Node-red:  
Within Node-red I am using the 'call service' node to activate the switch.... But when I set the entity in this node to say 'Send\_4', the result is activates all three commands (Send\_R, Send\_6, Send\_4).

```auto
[11:43:45][D][switch:013]: 'Send_R' Turning ON.
[11:43:45][D][switch:037]: 'Send_R': Sending state ON
[11:43:45][D][uart.switch:020]: 'Send_R': Sending data...
[11:43:45][D][switch:037]: 'Send_R': Sending state OFF
[11:43:45][D][switch:013]: 'Send_6' Turning ON.
[11:43:45][D][switch:037]: 'Send_6': Sending state ON
[11:43:45][D][uart.switch:020]: 'Send_6': Sending data...
[11:43:45][D][switch:037]: 'Send_6': Sending state OFF
[11:43:45][D][switch:013]: 'Send_4' Turning ON.
[11:43:45][D][switch:037]: 'Send_4': Sending state ON
[11:43:45][D][uart.switch:020]: 'Send_4': Sending data...
[11:43:45][D][switch:037]: 'Send_4': Sending state OFF

```

Using version 0.46.0 of the contrib-node.

Is this a bug? Any solution?  
Thank you!

---

<div class="post-metadata">

**Author:** ![andyp](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@andyp](https://discourse.nodered.org/u/andyp)\
**Post date:** [14 October 2022 05:04 UTC](https://discourse.nodered.org/t/issue-with-node-red-contrib-home-assistant-websocket-api-call-service/69005/2 "2022-10-14T05:04:04Z")

</div>

Seems everything under switch is sent if any individual task under switch is called using this api-service-call

For example, calling any one of these results in all three activating:

```auto
Switch:
  - platform: uart
    name: "Send_R"
    data: 'R'

  - platform: template
    name: "Switch_Send_6"
    id: switch_send_6
    turn_on_action:
      - uart.write: '6'

  - platform: template
    name: "Switch_Send_4"
    id: switch_send_4
    turn_on_action:
      - uart.write: '4'

```

---

<div class="post-metadata">

**Author:** ![andyp](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@andyp](https://discourse.nodered.org/u/andyp)\
**Post date:** [14 October 2022 06:15 UTC](https://discourse.nodered.org/t/issue-with-node-red-contrib-home-assistant-websocket-api-call-service/69005/3 "2022-10-14T06:15:55Z")

</div>

Solved! My lack of understanding - don't include the area and device in the node - otherwise all connected entities get triggered.....

---

<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:** [28 October 2022 06:16 UTC](https://discourse.nodered.org/t/issue-with-node-red-contrib-home-assistant-websocket-api-call-service/69005/4 "2022-10-28T06:16:41Z")

</div>

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