Received IR sends 2 messages

I am getting 2 messages from a received IR signal on a remote which is likely an unknown device. It is a small remote which came with some decorative candles and resembles the remotes which come with the various Arduino sensor kits, but with fewer buttons. What is odd is that the raw portions seem to differ when the same button is pressed. Here are 2 messages, in order received from one button press. The raw values seem to change with the same button press:

  • {“value”:283967743,“protocol”:3,“bits”:32,“hex”:“0x10ED00FF”,“protocol_name”:“NEC”,“raw”:“9014,4420,614,524,614,526,612,526,612,1636,614,520,616,524,614,526,614,530,614,1628,612,1632,612,1632,614,524,614,1630,614,1630,614,526,614,1636,614,524,614,528,614,524,610,526,614,526,612,530,608,526,614,528,612,1636,612,1630,612,1632,612,1632,612,1634,610,1634,614,1630,614,1630,612”}
  • {“value”:18446744073709551615,“protocol”:3,“bits”:0,“hex”:“0xFFFFFFFFFFFFFFFF”,“protocol_name”:“NEC”,“raw”:“9010,2192,610”}

I believe I have set mqtt_max_packet_size to 1024 in User_config.h on one of my units but this did not change the output. I have this loaded on a D1 Mini in both instances.

This is what I get on the unit I uploaded the code from PLatformIO on in the Serial console:
— Terminal on COM10 | 115200 8-N-1
— Available filters and text transformations: colorize, debug, default, direct, esp8266_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
— More details at Redirecting...
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
4,520,616,524,614,526,614,530,614,1628,612,1632,612,1632,614,524,614,1630,614,1630,614,526,614,1636,614,524,614,528,614,524,610,526,614,526,612,530,608,526,614,528,612,1636,612,1630,612,1632,612,1632,612,1634,610,1634,614,1630,614,1630,612"}
N: Send on /IRtoMQTT msg {“value”:18446744073709551615,“protocol”:3,“bits”:0,“hex”:“0xFFFFFFFFFFFFFFFF”,“protocol_name”:“NEC”,“raw”:“9010,2192,610”}
N: [ MQTT->OMG ]: {“value”:283967743,“protocol”:3,“bits”:32,“hex”:“0x10ED00FF”,“protocol_name”:“NEC”,“raw”:“9014,4420,614,524,614,526,612,526,612,1636,614,520,616,524,614,526,614,530,614,1628,612,1632,612,1632,614,524,614,1630,614,1630,614,526,614,1636,614,524,614,528,614,524,610,526,614,526,612,530,608,526,614,528,612,1636,612,1630,612,1632,612,1632,612,1634,610,1634,614,1630,614,1630,612”}
N: [ MQTT->OMG ]: {“value”:18446744073709551615,“protocol”:3,“bits”:0,“hex”:“0xFFFFFFFFFFFFFFFF”,“protocol_name”:“NEC”,“raw”:“9010,2192,610”}

Hi @Karl_S

If it is always sending the two messages, why not take one of them as your recognised button press message to use in your controller or however you want to process it?

I’d leave the “raw” portion on the side, as it might change with button press length/repeat, but would concentrate on the “value” and “protocol”/“protocol_name”.

The same should be applicable if you’d want to re-transmit this by IR.

I am not looking to know when a button was pressed on the remote, but to learn and mimic the functionality. My goal is to read the values and store them in my hub. This can be a manual process as I have limited remotes to learn at this time. Then I wish to use MQTT to send a message to have the gateway emit the desired IR signal.

Sending a message with either of the “value” and “protocol”/“protocol_name” pairs does not appear to work. I have also added the “bits” to the message. My assumption has been that this is not an NEC controller as returned and that the second message may be due to excess data.

Interestingly I have found that if I send one of the messages TWICE, in succession, the gateway controls the device. Setting a “repeat” value in the message does not seem to work, though. This is seems odd to me, but has been consistent on a dozen or so tests. Is there a way to have the gateway emit the IR signal twice with a defined delay between/ I am wondering if this is why sending the MQTT message twice works but setting the “repeat” does not. (Of course, I know little about IR signal use, so this is all speculation.)

This is one of the remotes in question. It came with a NooElec NESDR Mini 2 USB stick.

I am doing the same, and with most of my IR remotes, which I want to mimic, are protocol_name NEC and they work fine with just sending the value.

Hmm, strange, not knowing exactly how immediate the repeat signal is sent, have you tried setting it to 5 or even higher, with either of the above “value" or “hex" along with “bits”? Still no luck with these combinations?

And if increasing the number of repeats doesn’t suceed, you could always implement a double sending in your controller with a brief pause in between, if sending twice usually works for you.

I’ve never seen this issue here with my IR gateway, and one of the ‘leant’ remotes was very similar to yours.

P.S. OR sending the two different values one after the other?

Hmm, strange, not knowing exactly how immediate the repeat signal is sent, have you tried setting it to 5 or even higher, with either of the above “value" or “hex" along with “bits”? Still no luck with these combinations?

I set the repeat to 2, 5, 6, 7, 9, 12, and even 24 with no luck. I am using Node-RED to send the signals for testing and just injecting the message twice within less than a second. With repeat at 12 it is still emitting the first when the second message is received. In this case the unit accepts the command as soon as the second starts to emit, as determined with the flashing LED on the D1 Mini. The second message appears to go out with just a very momentary pause. Regardless of the repeat, it seems I need the message to go twice and in less than 1 second. I have tested and found that this only seems to be true for some of the remote’s items and not all.

I have added items to the message to try and get this to work without a second send. I’ve had all shown below, and also just the value or hex and protocol or protocol_name. Bits has been present or not present.
{
“value”: 283967743,
“protocol”: 3,
“bits”: 32,
“hex”: “0x10ED00FF”,
“protocol_name”: “NEC”,
“repeat”: 9
}

Guess I just need to go with 2 sends. At least sending all of the ones I am interested in twice doesn’t seem to change anything on the receiving end. If only one is needed, the second is ignored in these cases. Before I found OMG I was going to create my own emitters and code to do just what I am doing, so I am ahead of the game at this time.

1 Like

Sorry, should have mentioned that I had already tried that earlier.

Using the Resend Msg contrib in Node-RED I am able to repeat the message sent to the MQTT output node and set a time interval between the copies. I have found that this needs to be less than 1750 milliseconds between messages.