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 so very easy to set up.
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).
[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!