Implementation of the received infrared code possible?


would it be possible to transmit the received HEX codes via MQTT (my preferred way) or to provide them via the JSON-API ?

I like the way you think.
Maybe on the info page, if IR enabled, display last IR code received.
That might not be what you are after, but a custom usermod would certainly do what you are looking for.
I think if WLED were able to send say the last 10-16 IR codes in a single JSON-api request, you could push that many IR remote buttons and capture all the button codes in a single call. Then in a different API call, send just the last IR code received, or trigger an MQTT send for each IR code received.

If you want to build a usermod, if it is straightforward, @Aircoookie might merge it into WLED for everyone. If not, you’d still have your own problem solved.

I found this suggestion to expand the ir.cpp.

  char s[16];
  char subuf[38];

  strcpy(subuf, mqttDeviceTopic);
  strcat(subuf, "/ircode");
  mqtt->publish(subuf, 0, true, s);


If I now want to build the firmware myself, I get this message:

In file included from C:\Users\bla\WLED-master\WLED-master\wled00\wled.h:99,
from C:\Users\bla\WLED-master\WLED-master\wled00\wled00.ino:13:
C:\Users\bla\WLED-master\WLED-master\wled00\src\dependencies\espalexa\Espalexa.h:620:2: error: #endif without #if
620 | #endif
| ^~~~~

What and where do I have to change at Espalexa.h ?

I’ve been thinking about a better way to get the ir codes. Especially since the next release should allow the users to add support for most any remote without any coding or compiling. But you need to be able to get the IR codes in order to do that.

The codes are currently echoed on the serial port. Beginning in 0.13 it will be debug prints instead. Not hard for developers, but not easy for most users. Having the last 10 or 15 codes received in the JSON response is probably overly optimistic for being able to piece back together and map your buttons. Speaking as someone who has spent a fair amount of time mapping codes to buttons.

Using mqtt isn’t a bad idea, but still leaves the bar a little higher than I’d like.

I don’t want to use the IR codes to switch the LEDs, I want to be able to switch any device (in FHEM).
In practice, I just want to save myself an additional, for example, Tasmota device or something else.
And MQTT would be my preferred way of getting the codes.