Skip to content

Updating ESPHome NEC Remote Transmitter hex for v2021.12

Get your IR devices working again

After I updated to a more recent version of ESPHome and flashed my fan controller, it stopped being able to control the fan. After a bit of troubleshooting and searching, I found the culprit.


In version 2021.12, the order of transferring bits was corrected from MSB to LSB in accordance with the NEC standard. Therefore, if the the configuration file has come from an earlier version of ESPhome, it is necessary to reverse the order of the address and command bits when moving to 2021.12 or above. For example, address: 0x84ED, command: 0x13EC becomes 0xB721 and 0x37C8 respectively.

Remote transmitter docs

Clearly, I don’t read all of the release notes

So after reading this, I was confused. And if you’re here, you are probably confused. So here’s what I did to solve it. In my case, I used the python3 command line inside of my ESPHome docker container, but this should work anywhere you have python3 installed.

Steps for updaing the address and command values

  1. CLI into container
  2. Type python3
  3. Type bin(<value>) and replace value with the hex or decimal value.
  4. Reverse this value right to left: abc becomes cba, the 0b stays at the front.
  5. Count the number of digits, if it’s less than 16 digits, add zero’s at the end to make it 16 digits
  6. Type hex(0b<value>) and replace value with the reversed binary.
  7. Resulting hex should work as your command.


Below are the steps I used to convert my Fan Oscillation values:

So the new command is:

Published inESPHome