sui77 / rc-switch

Arduino lib to operate 433/315Mhz devices like power outlet sockets.
1.89k stars 653 forks source link

rc-switch custom protocol #420

Open kyme32 opened 3 years ago

kyme32 commented 3 years ago

Hello guys, i have a question with a custom protocol, i can't manage to make the rc-switch to capture the data. The sensor it's a mebus E0303WTR what sends random ID(generated randomly at start), channel, battery and temperature I've captured the data with an logic analyzer and it seems that data it's send 12 times in a row the pulse lenght it's 495us and the data looks like this sync: 1 pulse high, 8 low(495us high, 3900 low) 0 bit: 1 pulse high, 2 low(495us high, 970 low) 1 bit: 1 pulse high, 4 low(495us high, 1945 low) i've managed to decode the data using those functions

uint8_t getId(uint64_t packet) {
  uint8_t id = (packet >> 28) & 0xFF;
  return id;
}

uint8_t getBattery(uint64_t packet) {
  uint8_t batt = (packet >> 24) & 0x8;
  return batt ? 1 : 0;
}

uint8_t getChannel(uint64_t packet) {
  uint8_t channel = (packet >> 24) & 0x3;
  return channel+1;
}

float getTemperature(uint64_t packet) {
    int16_t t = packet >> 12 & 0x0FFF;
    t = 0x0800 & t ? 0xF000 | t  : t;
    float temperature = float(t) / 10;
  return temperature;
}

my problem is that the rc-switch doesn't get the data, i've tried to add a protocol in RCSwitch.cpp but it seems not to help in any way { 495, { 1, 8 }, { 1, 2 }, { 1, 4 }, false }

i suspect the way data it's transmitted, between those 12 series of data it's a 0 in lenght of 488us e0303wtr

i attach the pulseview waveform, perhaps it will help do i miss something? or do i create the sync badly? Thank you

e0303wtr.zip

Squirlier commented 2 years ago

Hello, a little bit old but..... As far as i know you need to change RCSwitch::nSeparationLimit to a value that is within your sync/pause window. look in rcswitch.cpp library...