Skip to content

How to convert 55 bit RF packets or send it out via MQTT? #6777

Answered by letshin
letshin asked this question in Q&A
Discussion options

You must be logged in to vote

Answered by @swoboda1337 on Discord. In case anyone finds this useful

  on_raw :
    then:
      - lambda: |-
          uint32_t ones = 0;
          uint32_t bits = 0;
          uint8_t bytes[6];
          ESP_LOGD("lambda", "Received raw data with length %d", x.size());
          for(auto i : x) {
            bool isZero = std::abs(1480 - std::abs(i)) < 200;
            bool isOne = std::abs(500 - std::abs(i)) < 200;
            bool isGap = std::abs(i) < 1580;
            bool level = (i >= 0);
            if (level && (isOne || isZero)) {
              if (ones == 7) {
                bytes[bits / 8] <<= 1;
                bytes[bits / 8] |= isOne ? 1 : 0;
                bits += 1;
  …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by letshin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant