Need help with Node Red call-service for ESPHOME IR transmitter
Built an IR transmitter with an esp32. I don't want to hard code all the commands in esphome so using a variable with the call service. It works great when called from HA developer tools but when I try to use a Node Red call service node, I can't seem to get it to work. If I use a YAML - JSON converter, it converts the NEC hex code to a numeral, it executes the call service but the IR command never fires. If I change it back to the hex, NR gives me an API error (tried both with and without quotes.) My research indicates that JSON doesn't deal with hex so not sure where to go with this. Help much appreciated.
ESPHOME Yaml:
api:
services:
- service: send_ir_code
variables:
command: int
address: int
then:
- remote_transmitter.transmit_nec:
address: !lambda 'return address;'
command: !lambda 'return command;'
HA Call Service YAML (works from Developer Tools):
service: esphome.irtester_send_ir_code
data:
command: 0xFE01
address: 0x7E81
Failed NR JSON:
{"command":0xFE01,"address":0x7E81}
Posted Jan 27, 2022, 4:46 AM UTC
12
So you're saying this is what you tried in NR, and it doesn't do anything?
If the call service accepts ints, then a number in a hexadecimal or decimal representation should be exactly the same.
Can you run logging on the ESP to see what it's doing with the service call?
Not sure if relevant, but I presume you saw this note in ESPHome docs:
Thanks for your reply. It is in fact working now with the numeral equivalent as you posted. I could swear I tried that exact format earlier but must have had something off (end of a long day).
Also, I didn't catch the change in 2021.12 that you pointed out. My version was older than that so that would have been an incredibly frustrating breaking change to figure out when I eventually updated had you not pointed that out.
I really appreciate the help.