Skip to content

Wrong offset for RTW decoding #514

Description

@VolkerMer

Hardware

ESP32

Firmware version

since v2.1.4

Application version

since v2.1.4

What happened? What did you expect to happen?

The RTW frame decoding gives wrong results, they are offset by 1.

void somfy_frame_t::decodeFrame(byte* frame) was changed in commit 74ee9f6f25fe5b63138a3e1d037124c5ba5a1095.
Before:

switch(this->encKey) {  
  case 149:
  case 133:
    this->cmd = somfy_commands::My;  

...
Then:

else if(this->encKey > 133) {
   this->proto = radio_proto::RTW;
   this->cmd = (somfy_commands)(this->encKey - 133);

As somfy_commands::My == 1, the subtrahend should be 132

How to reproduce it (step by step)

1. Go to log window
2. Click on any button of an RTW remote
...

Logs

{"encKey": 136,
  "address": 7339838,
  "rcode": 2898,
  "command": "My+Up",
  "rssi": -37,
  "bits": 56,
  "proto": 1,
  "valid": true,
  "sync": 4,
  "pulses": [102452,47299,10146,97684,2604,2564,2533,2596,4872,1281,1314,629,660,628,665,1276,1309,644,655,639,656,644,646,1289,648,644,653,636,656,645,644,637,661,624,668,630,1311,1269,681,615,654,643,1300,1291,1294,639,680,618,673,613,683,1273,1305,626,667,1280,657,644,1296,641,649,1269,1336,618,674,1265,1322,634,661,1267,668,634,1311,1268,659,615,1327,1281,657,619,1319,1267,1321,637,658,644,646,1289,1299,633,657,629,671],
  "time": "2024-12-28T17:50:55.385+0100"
},
{"encKey": 133,
  "address": 7339838,
  "rcode": 2899,
  "command": "Unknown(15)",
  "rssi": -42,
  "bits": 56,
  "proto": 1,
  "valid": false,
  "sync": 4,
  "pulses": [70071,32277,102404,102368,99866,2593,175,102356,673,10118,91598,1116,4985,2593,2563,2553,2569,4893,1281,1305,624,682,614,679,617,676,1260,1315,1289,1298,1285,657,642,646,637,661,624,668,631,660,641,1301,630,660,1291,643,633,660,640,1298,1284,1305,1275,1335,620,655,1283,1317,635,658,1270,654,635,1305,649,658,1267,1319,636,656,1269,1333,620,668,1258,664,644,1304,1274,674,613,1310,1270,687,627,1295,1288,1299,632,660,640,674,1272,1311,618,675,639,657],
  "time": "2024-12-28T17:51:00.165+0100"
},
{"encKey": 134,
  "address": 7339838,
  "rcode": 2900,
  "command": "My",
  "rssi": -42,
  "bits": 56,
  "proto": 1,
  "valid": true,
  "sync": 4,
  "pulses": [102400,1109,101262,19864,15995,44000,22577,9484,27918,18916,10128,59637,529,502,650,1371,474,1176,1749,19918,11683,2617,2555,2560,2577,4875,1292,1294,636,661,623,668,631,660,1291,668,609,1310,646,671,1265,672,620,655,639,657,644,1295,642,649,1294,1312,1268,659,641,651,617,1328,624,665,1280,1307,623,682,616,676,1268,1311,643,645,1286,665,621,1306,646,668,1261,1329,625,659,1266,1320,638,657,1271,656,639,1306,1277,659,647,1293,1292,645,649,1309,1270,1304,623,668,657,636,1280,1319,641,651,643,652],
  "time": "2024-12-28T17:51:02.460+0100"
},
{"encKey": 136,
  "address": 7339838,
  "rcode": 2901,
  "command": "My+Up",
  "rssi": -38,
  "bits": 56,
  "proto": 1,
  "valid": true,
  "sync": 4,
  "pulses": [102396,102367,40736,61702,63195,10144,97696,2565,2594,2536,2570,4894,1288,1300,631,660,630,671,1272,1309,643,654,639,655,642,647,1289,649,644,652,639,656,619,1322,639,649,644,654,638,656,1269,683,614,680,617,1323,614,667,1281,656,643,1296,641,648,1295,1311,617,676,1289,645,622,1308,645,669,1258,1306,650,659,1266,1319,639,658,1270,656,640,1316,1271,661,624,1320,1265,672,621,1308,1272,1326,641,643,649,659,1266,1320,614,684,620,670],
  "time": "2024-12-28T17:51:11.174+0100"
}

in time order:
down -> My + up     = 136
My   -> Unknown(15) = 133
up   -> My          = 134
down -> My + up     = 136

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions