irplus-remote / irplus-codes.github.io

Code updates for irplus
76 stars 47 forks source link

IR Codes with Arduino IR Remote library #528

Open DuroHeci opened 3 years ago

DuroHeci commented 3 years ago

Hello, I'm trying to use irplus to speak to an arduino to get some things automated. The library I'm using is: https://www.arduino.cc/reference/en/libraries/irremote/

I'm having problems dublicating IR codes I record via arduino from an cheap chinese led strip with IR remote.

When I press the button on my remote, this code is recieved via the arduino: Protocol=NEC Address=0xEF00 Command=0x3 Raw-Data=0xFC03EF00 32 bits LSB first

When I enter the code 0xFC03EF00 into irplus with WINLIRC_NEC1, the arduino recieves: Protocol=NEC Address=0x3F Command=0xF7 Parity fail Raw-Data=0xF7C03F 32 bits LSB first

There seems to be some switching around with the first and last part of the code.

If I enter the code in two 4 byte blocks of 0xFC03 0xEF00, I get: Protocol=NEC Address=0x3F Command=0xF7 Parity fail Raw-Data=0xF7C03F 32 bits LSB first

I think I'm missing some formating or standard that I cannot find. Can somebody guide me in the right direction?

irplus-remote commented 3 years ago

Hi LIRC does read the bits in a different way. Could you try 0xFE 0x03fc ? Or to figure out whats different - can you try to send with irplus 0x00ff and 0x00ff , this should give more insight whats going on (Note that in lirc there is most of the time a parity check e.g, in binary 0000 0000 1111 1111 0000 0000 1111 1111 is actually 16 bits with 16bits parity

irplus-remote commented 3 years ago

https://github.com/irplus-remote/irplus-codes.github.io/issues/453#issuecomment-526241199 here is a post which i did some time ago which explains more thoroughly

Openuser87 commented 11 months ago

Have been trying the same. Is there any easy possibility to convert Arduino IR receiver outputs (NEC protocol) into WINLIRC_NEC1 codes? If I get it correctly, these are just different representations of the same protocol, so there should be an algorithm to match them. I read the comment linked above and saw the script, but I did not get how to come from one HEX number to the other (the script converts binary values, seemingly because the requestor needed this; but how do I get those?).

Maybe there is some script to do it? If not, could you provide some guidance on the conversion steps - maybe we can get one together?

As Arduino IR modules are one of the most convenient ways to scrape IR codes from devices, this could possibly help many people to create irplus remotes...

I would be glad to provide any data / test results from my use case.

Biswa96 commented 11 months ago

Is there any easy possibility to convert Arduino IR receiver outputs (NEC protocol) into WINLIRC_NEC1 codes?

It is possible to convert NEC to Pronto code using this repository https://github.com/abidkyo/nec-converter

Openuser87 commented 11 months ago

Thank you! I tried it out and have two questions:

  1. the nec_converter binary requires 2 arguments: "frequency" and the code. I assume the code is a hex value I get from IRremote lib, e.g. BA45FF00. But where do I get the frequency from?
  2. the program returns binary code, so I can add this directly to irplus using, e.g., this converter, right? Here it's shown that I can also use hex codes. Are these Pronto or other format? How do I get them from Pronto values?
irplus-remote commented 11 months ago

To make a converter which always works with irplus it would be good to use RAW or PRONTO. The "encoded" formats are too different and it would require you to write more than one converter. Do you know if the Ardunio output can be set to RAW?

https://hutscape.com/tutorials/ir-raw-receive

then in the irplus xml you set a button like this:

<irplus>
    <device manufacturer="AEG" model="MC-4414" columns="12" format="WINLIRC_RAW">
        <button label="&#xf011;" alt="POWER" backgroundColor="FFC84334" span="4">8918 4446 572 546 546 546 572 546 572 546 572 546 546 546 572 546 572 546 546 1664 546 1664 546 1664 546 1664 546 1664 546 1664 546 1664 546 1664 546 546 572 1638 572 546 572 546 546 546 572 546 572 546 546 572 546 1664 546 546 572 1638 572 1638 572 1638 572 1638 572 1638 572 1638 572 39702 8892 2210 546 39702</button>
         ... other buttons...
    </device>
</irplus>

But yea if you just want one for NEC it should be easy

Address=0xEF00 Command=0x3

this one in LIRC would be:

Long Explaination: https://github.com/irplus-remote/irplus-codes.github.io/issues/453#issuecomment-526241199

Short explaination to convert from NEC to LIRC-NEC

First convert the command

0x3      =  0000 0011

to get the nec value we read the bits from right to left: 1100 0000, which in Hex is 0xC0 Then we apply the repeated sequence with inverted bits, to invert use 0xFF - 0xC0 = 0x3F

For the Address we do similar:

0xEF    =    11101111 , RtL => 1111 0111  ->  F7
0x00   =    0000 0000, RTL => 0000 0000  -> 00

So the NEC-LIRC notation in this case would be 0xF700 0xC03F so binary: 11110111000000001100000000111111

Biswa96 commented 11 months ago

where do I get the frequency from?

The frequency is always 38000 Hz (with 10% tolerance). More here https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol

Openuser87 commented 11 months ago

Works! :smiley:

I mean, the RAW variant with the Arduino IRLib2 library and WINLIRC_RAW format. Thank you very much!

Also big thanks for the explanation of converting steps, seems relatively easy to write a conversion script. Will try to look at that more carefully later.

Just one question now: for an exemplary NEC code 0xBA45FF00, how do you break it down? I only understand that 0x45 is the command, as that's what IRRemote library suggests for it's sending code (IrSender.sendNEC(0x0, 0x45, 1)). But there is also the address, and some other parts (device / subdevice?)...

Openuser87 commented 11 months ago

The frequency is always 38000 Hz (with 10% tolerance). More here https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol

Thank you, so would the proper command be

./nec_converter 38000 0xB847FF00

?

Will test that later also.

irplus-remote commented 11 months ago

In theory the NEC protocol has always 32-bits, in theory you could imagine codes from binary 0000 0000 0000 0000 0000 0000 0000 0000 to 1111 1111 1111 1111 1111 1111 1111 1111. But in practical use for fault-tolerance only a part of those are used to encode a remote button of a device, the first 16 bits are used for address or device code which is the same for every button of one specific device. the other 16 are used for the button, 8 for the code and 8 for the code inverted for fault-tolerance. Now some notations split the device-code into "device" and "subdevice" , but other notations like lirc do NOT.

i personally always like to look at the binary sequence:

image

irplus-remote commented 11 months ago

Its so confusing.. why.. I would personally send raw..

/// Send a raw NEC(Renesas) formatted message.
/// Status: STABLE / Known working.
/// @param[in] data The message to be sent.
/// @param[in] nbits The number of bits of message to be sent.
/// @param[in] repeat The number of times the command is to be repeated.
/// @note This protocol appears to have no header.
/// @see http://www.sbprojects.net/knowledge/ir/nec.php
void IRsend::sendNEC(uint64_t data, uint16_t nbits, uint16_t repeat) {
Openuser87 commented 11 months ago

To get it to something tangible, I accomplished a remote with RAW. What is the best way to contribute the result?

Will post it here for now.

For those searching: these are 4 colored LED lamps, manufacturer's name is iLC - but probably there are several products for which it will suit; they have a subscript "Practical Series II" on the remote.

There was already a contributor who found out codes for 4 buttons. That post inspired me initially, unfortunately I could not find a link anymore...

<irplus>
 <device manufacturer="iLC" model="iLC LED GU10" columns="3" format="WINLIRC_RAW">
  <button label="ON" labelSize="30.0" backgroundColor="FF1E7854">9078  4394  638  486  666  462  666  458 670  458  634  494  634  494  634  490 638  490  630  1598  662  1566  658  1570 630  1598  654  1570  626  1602  626  1602 626  1602  622  1606  622  502  622  1606 594  534  618  510  594  534  590  1634 594  534  614  514  614  1614  614  510 594  1634  614  1614  582  1646  582  546 578  1650  550  1000</button>
  <button label="W-min" labelSize="30.0" labelColor="FF000000" backgroundColor="FFFFFFFF">9054  4422  666  458  634  494  638  434 694  490  662  462  634  494  638  490 630  498  630  1598  626  1602  626  1602 626  1602  630  1598  598  1630  626  1602 626  1602  622  506  622  1606  618  1614 618  506  622  506  594  534  594  1634 590  538  590  1638  618  510  586  542 586  1642  582  1646  582  1646  582  546 578  1650  578  1000</button>
  <button label="OFF" labelSize="30.0" backgroundColor="FFC84334">9086  4386  674  354  770  362  766  454 670  454  674  454  642  486  638  490 666  458  670  1558  670  1558  670  1558 666  1562  662  1562  638  1590  638  1590 638  1590  670  1558  634  1594  638  1590 634  494  630  494  634  494  658  1570 626  502  630  494  662  466  634  450 670  1602  626  1598  630  1598  630  498 626  1602  626  1000</button>
  <button label="C" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">9050  4422  642  486  666  462  634  494 658  466  630  458  702  466  654  402 734  462  634  1594  630  1598  630  1598 626  1602  630  1598  630  1598  626  1602 626  1606  618  506  622  506  594  1634 618  510  590  538  590  538  586  1638 590  538  590  1638  590  1638  594  534 610  1618  586  1642  582  1646  578  550 582  1646  578  1000</button>
  <button label="24H" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">9046  4430  658  466  634  494  630  498 658  470  626  502  626  502  634  490 626  502  626  1606  602  1626  626  1602 630  1598  626  1602  626  1602  622  1606 622  1606  622  482  646  506  618  510 590  538  618  510  622  502  622  1606 618  510  594  1638  618  1610  590  1638 618  1610  594  1634  618  1610  594  534 618  1610  590  1000</button>
  <button label="1H" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">9074  4394  626  498  634  490  638  490 630  498  658  466  630  498  630  498 630  494  630  1602  626  1598  626  1602 622  1602  630  1598  626  1602  622  1602 626  1602  590  1638  614  1610  622  506 618  510  590  534  590  538  590  1634 590  538  614  510  590  538  586  1642 582  1646  582  1642  582  1646  578  550 578  1646  550  1000</button>
  <button label="S" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">9038  4426  634  490  634  494  662  466 634  494  630  494  630  498  626  466 658  502  630  1598  626  1602  626  1602 630  1598  626  1598  626  1602  622  1606 622  1606  618  1610  622  1606  622  1602 598  530  622  506  618  506  594  534 614  514  614  514  614  510  618  510 618  1610  614  1610  590  1638  618  1610 614  1614  586  1000</button>
  <button label="+" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">9082  4394  670  454  646  482  634  494 690  322  782  462  638  490  638  490 630  494  666  1566  634  1594  634  1594 634  1594  634  1594  630  1598  626  1606 622  1606  622  1606  626  498  626  1606 622  502  594  1634  594  534  622  506 590  538  614  514  586  1642  586  542 586  1638  590  538  586  1642  582  1646 586  1646  582  1000</button>
  <button label="-" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">9074  4398  662  462  630  498  634  490 630  498  626  502  626  498  630  498 630  498  622  1606  622  1606  622  1606 618  1610  618  1610  594  1634  622  1606 594  1630  622  1606  590  538  614  514 610  1618  586  542  586  538  586  542 586  542  610  518  582  1646  582  1646 578  546  582  1650  574  1650  554  1678 546  1682  546  1000</button>
  <button label="R" labelSize="30.0" backgroundColor="FFC84334">9046  4422  630  498  634  446  674  498 630  498  598  526  630  498  626  502 626  462  662  1602  630  1598  626  1602 622  1606  590  1638  646  1578  622  1606 622  1606  618  510  590  1634  618  1610 614  514  586  1642  586  538  586  542 586  542  586  1642  578  546  582  546 582  1646  582  546  578  1650  574  1654 546  1682  546  1000</button>
  <button label="G" labelSize="30.0" backgroundColor="FF1E7854">9082  4386  670  458  666  458  642  486 666  378  722  490  634  490  638  490 638  490  634  1594  634  1594  658  1570 630  1598  662  1566  630  1598  630  1598 630  1594  630  1598  630  498  626  470 658  1602  626  1602  626  498  626  502 622  506  626  502  626  1602  598  1630 622  502  626  502  622  1606  622  1606 598  1630  618  1000</button>
  <button label="B" labelSize="30.0" backgroundColor="FF2A4C94">9086  4386  670  458  634  454  710  454 642  486  662  466  638  490  634  494 630  494  662  1570  630  1594  638  1594 634  1590  634  1594  606  1622  634  1594 630  1598  630  1598  630  498  630  1598 630  1598  622  506  622  502  622  478 654  502  622  506  618  1610  622  502 622  506  618  1610  618  1610  594  1638 590  1638  586  1000</button>
  <button label="DOrng" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FFFF6600">8962  4510  598  526  594  534  590  534 594  526  594  542  618  510  614  514 590  530  586  1646  594  1634  590  1638 594  1634  590  1638  590  1638  618  1606 622  1610  594  530  618  490  610  1638 594  1634  594  534  586  538  590  538 586  542  586  1642  618  1610  618  510 586  542  582  1646  586  1642  586  1642 582  1646  582  1000</button>
  <button label="Cyan" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FF00FFFF">9070  4402  630  494  638  490  630  458 694  394  702  470  662  498  622  502 626  502  626  1602  626  1598  630  1602 622  1602  626  1602  626  1602  594  1634 622  1606  630  494  626  502  622  506 622  1606  622  1606  622  506  614  510 594  534  622  1602  622  1610  622  1602 622  506  618  510  618  1610  618  1606 618  1610  594  1000</button>
  <button label="Indigo" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FF0066FF">9070  4402  634  494  634  490  634  494 634  494  634  494  630  494  634  494 634  454  670  1598  626  1602  630  1594 630  1598  630  1602  622  1602  626  1602 658  1574  630  494  658  1570  630  1598 622  1606  622  1606  622  502  622  1606 622  506  618  1610  618  510  618  506 590  538  594  534  590  1638  594  530 618  1610  594  1000</button>
  <button label="Violet" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FF9900FF">8994  4474  626  466  626  534  622  510 618  482  610  542  586  542  590  530 594  538  622  1606  594  1634  594  1634 590  1638  622  1606  590  1638  646  1578 594  1634  594  534  622  506  614  514 586  1642  586  538  618  510  594  534 586  542  618  1610  618  1610  622  1606 594  534  590  1638  590  1638  590  1638 590  1638  586  1000</button>
  <button label="Orange" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FFFF9900">9038  4430  626  498  630  502  598  526 622  506  622  502  630  498  622  506 618  510  594  1630  622  1606  622  1606 622  1606  618  1610  618  1610  618  1610 590  1638  614  514  586  538  590  1638 586  1646  582  1642  586  542  582  546 578  546  582  1646  578  1650  550  578 546  582  546  582  542  1682  546  1682 542  1686  542  1000</button>
  <button label="LBlue" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FF6666FF">9114  4362  674  454  666  458  666  462 638  490  666  462  638  486  642  486 638  490  670  1558  662  1566  634  1594 666  1562  658  1570  658  1570  630  1594 666  1562  634  494  658  1570  658  470 626  1602  630  1598  626  502  626  1602 626  498  626  1602  626  502  622  1606 622  506  622  502  618  1610  626  502 622  1606  594  1000</button>
  <button label="Rose" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FFE89D9E">9038  4430  626  498  630  458  670  494 634  494  630  498  626  502  622  502 626  502  598  1630  594  1634  622  1606 622  1606  590  1638  622  1602  618  1610 622  1606  622  506  586  1642  590  534 590  538  594  534  586  538  586  1642 594  534  590  1638  594  534  586  1638 590  1642  614  1614  586  1638  590  538 586  1642  586  1000</button>
  <button label="Yellow" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FFFFCC00">8990  4486  586  542  582  502  626  538 586  502  602  570  586  534  582  550 562  566  586  1642  590  1638  582  1646 586  1642  554  1674  578  1650  578  1650 578  1650  578  550  546  1678  554  574 554  574  550  1678  550  574  550  1682 546  578  554  1674  554  574  574  1654 546  1682  542  582  550  1682  542  582 546  1682  542  1000</button>
  <button label="W-Max" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">8998  4474  622  506  594  526  598  534 626  502  590  538  594  534  586  534 594  538  586  1642  590  1638  590  1638 618  1610  590  1638  586  1642  582  1646 582  1646  582  542  582  1646  586  542 582  1646  582  546  582  542  558  1670 578  550  582  1646  578  550  550  1678 550  574  582  1650  574  1654  546  582 546  1682  546  1000</button>
 </device>
</irplus>
Openuser87 commented 11 months ago

Thank you, so would the proper command be

./nec_converter 38000 0xB847FF00

?

Will test that later also.

Tried this:

./build/nec_converter 38000 0xB847FF00
freq: 38000, code: B847FF00
0000 006D 0022 0002 0156 00AB 0015 0040 0015 0015 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0040 0015 0040 0015 0040 0015 0040 0015 0040 0015 0040 0015 0040 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 05EE 0156 0056 0015 0E47

Pasted it into the above remote and changed to format="PRONTO_HEX".

Did NOT work. Also not with frequency 38028 (seems it's what has been automatically added by irplus mobile app).

irplus-remote commented 11 months ago

where did you get 0xB847FF00 from? im not sure if we're talking about the same source? do you have a proper read file?

irplus-remote commented 11 months ago

image you could also check the signal in ir-scrutinizer with the real remote if you have it

Openuser87 commented 11 months ago

where did you get 0xB847FF00 from? im not sure if we're talking about the same source? do you have a proper read file?

This is the output of IRRemote library for Arduino (as per my original question).

These are the codes for all the 21 buttons:

BA45FF00
B946FF00
B847FF00
BB44FF00
BF40FF00
BC43FF00
F807FF00
EA15FF00
F609FF00
E916FF00
E619FF00
F20DFF00
F30CFF00
E718FF00
A15EFF00
F708FF00
E31CFF00
A55AFF00
BD42FF00
AD52FF00
B54AFF00
irplus-remote commented 11 months ago

It seems the device and command are inverted here?

Openuser87 commented 11 months ago

With your algorithm from above, I managed to convert the commands from the above into WINLIRC_NEC1. I still have to look at the address part. But given the address is already known (from the one post I found that time), I managed to get a working irplus remote with WINLIRC_NEC1 commands:

<irplus>
 <device manufacturer="iLC" model="iLC LED GU10 (WINLIRC_NEC1)" columns="3" format="WINLIRC_NEC1">
  <button label="ON" labelSize="30.0" backgroundColor="FF1E7854">0x00ff 0xA25D</button>
  <button label="W-min" labelSize="30.0" labelColor="FF000000" backgroundColor="FFFFFFFF">0x00ff 0x629D</button>
  <button label="OFF" labelSize="30.0" backgroundColor="FFC84334">0x00ff 0xE21D</button>
  <button label="C" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">0x00ff 0x22DD</button>
  <button label="24H" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">0x00ff 0x02FD</button>
  <button label="1H" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">0x00ff 0xC23D</button>
  <button label="S" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">0x00ff 0xE01F</button>
  <button label="+" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">0x00ff 0xA857</button>
  <button label="-" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">0x00ff 0x906F</button>
  <button label="R" labelSize="30.0" backgroundColor="FFC84334">0x00ff 0x6897</button>
  <button label="G" labelSize="30.0" backgroundColor="FF1E7854">0x00ff 0x9867</button>
  <button label="B" labelSize="30.0" backgroundColor="FF2A4C94">0x00ff 0xB04F</button>
  <button label="DOrng" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FFFF6600">0x00ff 0x30CF</button>
  <button label="Cyan" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FF00FFFF">0x00ff 0x18E7</button>
  <button label="Indigo" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FF0066FF">0x00ff 0x7A85</button>
  <button label="Violet" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FF9900FF">0x00ff 0x10EF</button>
  <button label="Orange" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FFFF9900">0x00ff 0x38C7</button>
  <button label="LBlue" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FF6666FF">0x00ff 0x5AA5</button>
  <button label="Rose" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FFE89D9E">0x00ff 0x42BD</button>
  <button label="Yellow" labelColor="FFFFFFFF" labelSize="30.0" backgroundColor="FFFFCC00">0x00ff 0x4AB5</button>
  <button label="W-Max" labelColor="FF000000" labelSize="30.0" backgroundColor="FFFFFFFF">0x00ff 0x52AD</button>
 </device>
</irplus>
Openuser87 commented 11 months ago

It seems the device and command are inverted here?

Could be... The commands are the 3rd and 4rth character of the 8, e.g. BA45FF00 -> command is 45.

irplus-remote commented 11 months ago

ba45ff00 is

10111010010001011111111100000000

if we read from right to left this would lead to

00000000111111111010001001011101

which is 0x00ffa25d

now it makes sense :)

Openuser87 commented 11 months ago

So here is a small script to convert commands (3rd and 4rth character of the HEX code from IRRemote output, e.g. BA45FF00 -> command is 45):

#!/bin/bash
if [ $# -ne 1 ]; then
    echo "Usage: $0 <hex_value>"
    exit 1
fi

bin=$(echo "ibase=16;obase=2;$1" | bc) 

while [ ${#bin} -lt 8 ]; do
  bin="0$bin"
done

echo "Binary value: $bin"

rev=$(echo $bin | rev)

echo "Reverted value: $rev"

inv=$(echo $rev | tr 01 10) 

echo "Inversed reverted value: $inv"

hex1=$(echo "obase=16;ibase=2;$rev" | bc) 
hex2=$(echo "obase=16;ibase=2;$inv" | bc) 

echo "Command HEX: $hex1$hex2"
Openuser87 commented 11 months ago

ba45ff00 is

10111010010001011111111100000000

if we read from right to left this would lead to

00000000111111111010001001011101

which is 0x00ffa25d

now it makes sense :)

Than it's even easier:

#!/bin/bash
if [ $# -ne 1 ]; then
    echo "Usage: $0 <hex_value>"
    exit 1
fi

bin=$(echo "ibase=16;obase=2;$1" | bc) 

while [ ${#bin} -lt 8 ]; do
  bin="0$bin"
done

echo "Binary value: $bin"

rev=$(echo $bin | rev)

echo "Reverted binary value: $rev"

hexnec=$(echo "obase=16;ibase=2;$rev" | bc) 

echo "Resulting HEX: $hexnec"

while [ ${#hexnec} -lt 8 ]; do
  hexnec="0$hexnec"
done

echo "Command HEX for irplus: 0x$(echo $hexnec | cut -c1-4) 0x$(echo $hexnec | cut -c5-8)"
Openuser87 commented 11 months ago

At least for my part, the question is resolved (except for the nec-converter part), thanks for the guidance!

The only question remaining is if we can generalize anything here. Original requestor had FC03EF00 as an example, the above script gives 0x00F7 0xC03F for that, would be interesting to know if it would work in that case. But if each device / manufacturer is different, then not sure how many use cases that approach will cover. Would any further steps make sense (documentation, additions to app code, converter tools on the web page...)?

To summarize the topic so far - these are the methods to get the NEC codes from Arduino IR receiver into irplus:

  1. Use the library IRremote and the "normal" output from e.g. Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX);, then apply some conversion (like the script above) to get the WINLIRC_NEC1 codes accepted by irplus
  2. OR use IRLib2 (can use the example code here right away, just specify your receiver's pin) and take the RAW data, remove the commas and line breaks and put the values into irplus, specifying WINLIRC_RAW as format; (by the way, IRremote can output RAW as well with IrReceiver.printIRResultRawFormatted(&Serial);; but the output has some extra characters, was not sure what exactly to copy into the irplus file
  3. OR (theoretically) use nec-converter to convert into Pronto format (see above); specify PRONTO_HEX as format in irplus
Openuser87 commented 11 months ago

The contribution question also remains. Seems here they are also asking...

irplus-remote commented 11 months ago

I could also introduce a new format "ARDUINO_NEC1" in the app.. :) then we can avoid this conversion stuff but i need some time for that.

Biswa96 commented 11 months ago

Wouldn't it be simple and consistent for the app if it supports only one format? For example, the xml file have only the int array which is passed to transmit function. Then user can convert other format using some scripts.

irplus-remote commented 11 months ago

The app supporting multiple formats saves / saved me a lot of work when adding new codes because on the internet you find them in many various formats and to be honest i'm to lazy to unify them. So the App will continue to support multiple formats and the user may choose to write the XML files how they want. Only if the format is not supported a conversion is needed

Also there are some formats with special stuff like toggle bits or repeat sequences which cant be replicated with a single format