Easier way to find raw repeating 433mhz codes without the log getting flooded

This is a easier way to find raw repeating codes in esphome without the log getting flooded with all the 433mhz noice
https://github.com/flax2000/esphome-find_raw_repeating-433
Just set the RX433_PIN and board type in raw_repeating_433.yaml and upload the code, you will get 2 sliders in homeassistant, nSeparationLimit(idle) and tolerance (tolerance here are a number not % as in esphome Remote Receiver)

change the nSeparationLimit and mayby the tolerance if necessary untill you recieve the signal:

[07:12:23][D][diy raw:178]: size: 48 idle pulse 2289 pulses: [411, -1130, 1184, -367, 404, -1137, 1184, -372, 1179, -379, 1170, -378, 1169, -394, 383, -1152, 39 5, -1151, 392, -1142, 1175, -391, 1154, -409, 364, -1156, 390, -1166, 384, -1159 , 1156, -403, 376, -1162, 1158, -396, [07:12:23][D][diy raw:193]: 1153, -403, 1151, -412, 367, -1170, 379, -1164, 37 9, -1162, 383, -1161] [07:12:23][D][diy raw:196]: signal done [07:12:23][D][:197]:

remove the logg messages from the text untill you have this

[411, -1130, 1184,-367, 404, -1137, 1184, -372, 1179, -379, 1170, -378, 1169, -394, 383, -1152, 395, -1151, 392, -1142, 1175, -391, 1154, -409, 364, -1156, 390, -1166, 384, -1159, 1156, -403, 376, -1162, 1158, -396,1153, -403, 1151, -412, 367, -1170, 379, -1164, 379, -1162, 383, -1161]

this is what you use in esphome Remote Receiver

remember to set the idle: to a value less then idle pulse 2289 like 2ms, tolerance: 60% and filter: 100us should work ok

this code also picks up sensors that send repeating codes like my TFA rain meter…

this code uses a modified rc-switch receiver code to first read in the signal and then compare it to the next signal

void RECEIVE_ATTR raw_data(uint16_t duration) {

  static uint16_t changeCount = 0;
  static uint16_t repeatCount = 0;

  static uint16_t lenght = 0;
  static uint16_t counter = 1;
  if (raw_lenght_done == 0) {

    if (duration > nSeparationLimit) {
      nSeparation_pulse_state = !digitalRead(RX433_PIN);
      // A long stretch without signal level change occurred. This could
      // be the gap between two transmission.
      if ((repeatCount == 0) || (diff_raw(duration, timings_raw[0]) < tolerance)) {
        // This long signal is close in length to the long signal which
        // started the previously recorded timings; this suggests that
        // it may indeed by a a gap between two transmissions (we assume
        // here that a sender will send the signal multiple times,
        // with roughly the same gap between them).
        repeatCount++;
        if (repeatCount == 2) {

          if ((changeCount - 1) > 8)  //ignore short transmissions
          {
            raw_lenght_done = 1;
            lenght = changeCount - 1;
            repeatCount = 0;
            changeCount = 0;
            return;
          }
          repeatCount = 0;
        }
      }
      changeCount = 0;
    }

    // detect overflow
    if (changeCount >= RAW_MAX_CHANGES) {
      changeCount = 0;
      repeatCount = 0;
    }


    timings_raw[changeCount++] = duration;
  }


  if (raw_lenght_done == 1) {
    if ((diff_raw(duration, timings_raw[counter]) < tolerance)) {
      counter++;

      if (counter == lenght) {
        raw_lenght_done = lenght;
        counter = 1;
        return;
      }
    } else {
      raw_lenght_done = 0;
      counter = 1;
    }
  }
}
1 Like