Anyone here every played with IR commands?

I have just bought one of these IR pucks and flashed with with Tasmota so I can keep things local.

I made a simple flow to test it and it is receiving data when I point a remote at it and press a button.

Thing is I don't know how to send that message back to the puck to repeat the command it just saw.

This is the basic flow.

It looks at the topic and if it is from the puck, it saves it to context.
If a message with payload set to "SEND" it sets the payload to the stored value and sends it.

Alas nothing happens.

[{"id":"478161dd.30b0b8","type":"function","z":"b95543c8.1478f8","name":"","func":"if (msg.topic == \"IR_REMOTE_CONTROL/tele/RESULT\")\n{\n    //  Save to context.\n    context.set(\"1\",msg.payload);\n    node.warn(\"Saved\");\n    return;\n}\nif (msg.payload == \"SEND\")\n{\n    msg.payload = context.get(\"1\");\n    return msg;\n}\n","outputs":1,"noerr":0,"x":310,"y":1280,"wires":[["92a365c6.af355"]]},{"id":"d20f5a68.c104c","type":"mqtt in","z":"b95543c8.1478f8","name":"IR_Command_RX","topic":"IR_REMOTE_CONTROL/#","qos":"2","datatype":"auto","broker":"8a2e80be.f7c928","x":170,"y":1200,"wires":[["2df2942d.674894","478161dd.30b0b8"]]},{"id":"92a365c6.af355","type":"mqtt out","z":"b95543c8.1478f8","name":"","topic":"IR_Command_TX","qos":"","retain":"","broker":"8a2e80be.f7c928","x":530,"y":1280,"wires":[]},{"id":"37235a8f.e72fce","type":"inject","z":"b95543c8.1478f8","name":"","topic":"","payload":"SEND","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":1280,"wires":[["478161dd.30b0b8"]]},{"id":"2df2942d.674894","type":"debug","z":"b95543c8.1478f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":350,"y":1150,"wires":[]},{"id":"8a2e80be.f7c928","type":"mqtt-broker","z":"","name":"MQTT host","broker":"192.168.0.99","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"ARDUINO_STATUS","birthQos":"2","birthPayload":"connected","willTopic":"ARDUINO_STATUS","willQos":"0","willPayload":"disconnected"}]

What IR puck did you purchase?

This one.

Going through the fun of testing, but am not having much joy.

Though I have since discovered the command should be more like:

msg = {"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E0D02F","DataLSB":"0x07070BF4","Repeat":4};

With the topic of: IR_REMOTE_CONTROL/cmnd/IRSend

But the puck isn't receiving that in its console.

This is the modified flow:

[{"id":"2fa6f939.231a8e","type":"inject","z":"b95543c8.1478f8","name":"","topic":"","payload":"SEND","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":1350,"wires":[["25b3f758.654538"]]},{"id":"25b3f758.654538","type":"function","z":"b95543c8.1478f8","name":"","func":"msg = {\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0D02F\",\"DataLSB\":\"0x07070BF4\",\"Repeat\":4};\n\n//msg = {\"IrReceived\":{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0D02F\",\"DataLSB\":\"0x07070BF4\",\"Repeat\":0}}\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":1350,"wires":[["d3bd9bd9.761bc"]]},{"id":"d3bd9bd9.761bc","type":"change","z":"b95543c8.1478f8","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"IR_REMOTE_CONTROL/cmnd/IRSend","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":1280,"wires":[["92a365c6.af355","a0855ef3.c05038"]]},{"id":"92a365c6.af355","type":"mqtt out","z":"b95543c8.1478f8","name":"IR_TX","topic":"IR_Command_TX/cmnd/IRSend","qos":"","retain":"","broker":"8a2e80be.f7c928","x":730,"y":1280,"wires":[]},{"id":"8a2e80be.f7c928","type":"mqtt-broker","z":"","name":"MQTT host","broker":"192.168.0.99","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"ARDUINO_STATUS","birthQos":"2","birthPayload":"connected","willTopic":"ARDUINO_STATUS","willQos":"0","willPayload":"disconnected"}]

This is what I see in the debug window:
{"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E0D02F","DataLSB":"0x07070BF4","Repeat":4,"_msgid":"df5bf20e.44991","topic":"IR_REMOTE_CONTROL/cmnd/IRSend"}

And this is the bigger picture looking at the device's console, the message is not received.

That looks like a BIG rabbit hole - I'm going to slowly climb out :slight_smile:

JFI I use LIRC on old Jessie on Pi for my IR stuff so this is way beyond my paygrade :slight_smile:

No problems. It is my problem. Thanks though.

I'm guessing/hoping it will be a stupid thing I am doing like the topic or something like that not being exact.

Been trying and (still) not having any luck.

The question still stands: Has anyone got one of these who could help me with getting it working?

Progress, but still not there.

If I enter this from a CLI it works:
mosquitto_pub -h 192.168.0.99 -t "IR_REMOTE_CONTROL/cmnd/IRSend" -m "{"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E0D02F","Repeat":4}"

But I am now stuck how to put that into a MQTT message in Node-Red.

(Typically as I have now posted the question I will work it out. But if I don't: I won't.)

If you don't mind, maybe show me where I am messing it up.

This is the flow as of now:

[{"id":"2fa6f939.231a8e","type":"inject","z":"b95543c8.1478f8","name":"","topic":"","payload":"SEND","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":1350,"wires":[["25b3f758.654538"]]},{"id":"25b3f758.654538","type":"function","z":"b95543c8.1478f8","name":"","func":"//msg = {\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0D02F\",\"DataLSB\":\"0x07070BF4\",\"Repeat\":4};\n//msg.IRSend = {\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0D02F\",\"DataLSB\":\"0x07070BF4\",\"Repeat\":4};\n//msg.IRSend = {\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0D02F\",\"Repeat\":4};\nmsg = {\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0D02F\",\"Repeat\":4};\n//msg = {\"IrReceived\":{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0D02F\",\"DataLSB\":\"0x07070BF4\",\"Repeat\":0}}\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":1350,"wires":[["d3bd9bd9.761bc"]]},{"id":"d3bd9bd9.761bc","type":"change","z":"b95543c8.1478f8","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"IR_Command_TX/cmnd/IRSend","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":1280,"wires":[["92a365c6.af355","a0855ef3.c05038"]]},{"id":"92a365c6.af355","type":"mqtt out","z":"b95543c8.1478f8","name":"IR_TX","topic":"","qos":"","retain":"","broker":"8a2e80be.f7c928","x":730,"y":1280,"wires":[]},{"id":"8a2e80be.f7c928","type":"mqtt-broker","z":"","name":"MQTT host","broker":"192.168.0.99","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"ARDUINO_STATUS","birthQos":"2","birthPayload":"connected","willTopic":"ARDUINO_STATUS","willQos":"0","willPayload":"disconnected"}]

Found the problem!

topic should have been IR_REMOTE_CONTROL/cmnd/IRSend

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