Skip to content

Instantly share code, notes, and snippets.

View simeon-walker's full-sized avatar

Simeon Walker simeon-walker

View GitHub Profile
@simeon-walker
simeon-walker / README.md
Created May 9, 2024 22:12 — forked from mildsunrise/README.md
Documentation of Tuya's weird compression scheme for IR codes

[Tuya][]'s IR blasters, like the [ZS08][], have the ability to both learn and blast generic IR codes. These IR codes are given to the user as an opaque string, like this:

A/IEiwFAAwbJAfIE8gSLIAUBiwFAC+ADAwuLAfIE8gSLAckBRx9AB0ADBskB8gTyBIsgBQGLAUALA4sB8gRAB8ADBfIEiwHJAeARLwHJAeAFAwHyBOC5LwGLAeA97wOLAfIE4RcfBYsB8gTyBEAFAYsB4AcrCYsB8gTyBIsByQHgPY8DyQHyBOAHAwHyBEAX4BVfBIsB8gTJoAMF8gSLAckB4BUvAckB4AEDBfIEiwHJAQ==

Not much is known about the format of these IR code strings, which makes it difficult to use codes obtained through other means (such as a

@simeon-walker
simeon-walker / tuya_ir_encode.js
Created May 9, 2024 22:08 — forked from andrewcchen/tuya_ir_encode.js
Encode an NEC IR command into code for Tuya ZS06/ZS08/TS1201
/*
Encode an NEC IR command into code for Tuya ZS06/ZS08/TS1201
Usage: encode_nec("<four bytes in hex, two bytes of address followed by two bytes of command>")
If your address and/or command is just one byte (8 bits), append the complement of the byte after it to make it two bytes.
Example:
encode_nec("04fb08f7") // encodes nec address 0x04 and command 0x08
See: