diff --git a/data-src/index.js b/data-src/index.js
index 1951863..69dcb70 100644
--- a/data-src/index.js
+++ b/data-src/index.js
@@ -2934,7 +2934,8 @@ class Somfy {
proto = '-V';
break;
}
- let html = `
`;
+ let rawCmdHex = (typeof frame.rawCmd === 'number') ? `0x${frame.rawCmd.toString(16).toUpperCase()}` : '';
+ let html = `
${frame.encKey}${frame.address}${frame.command}${frame.stepSize ? frame.stepSize : ''}${frame.rcode}${frame.rssi}dBm${frame.bits}${proto}${fnFmtTime(frame.time)}${rawCmdHex}`;
for (let i = 0; i < frame.pulses.length; i++) {
if (i !== 0) html += ',';
html += `${frame.pulses[i]}`;
diff --git a/data-src/main.css b/data-src/main.css
index f84458d..25d716b 100644
--- a/data-src/main.css
+++ b/data-src/main.css
@@ -832,6 +832,11 @@ div.frame-header > span {
text-align: right;
white-space:nowrap;
}
+ div.frame-row > span:nth-child(8),
+ div.frame-header > span:nth-child(8) {
+ width: 40px;
+ text-align: center;
+ }
div.frame-list > div:nth-child(2n+1) {
background: beige;
diff --git a/src/Somfy.cpp b/src/Somfy.cpp
index 0466520..70ba179 100644
--- a/src/Somfy.cpp
+++ b/src/Somfy.cpp
@@ -153,7 +153,8 @@ void somfy_frame_t::decodeFrame(byte* frame) {
this->checksum = decoded[1] & 0b1111;
this->encKey = decoded[0];
// Lets first determine the protocol.
- this->cmd = (somfy_commands)((decoded[1] >> 4));
+ this->rawCmd = decoded[1] >> 4;
+ this->cmd = (somfy_commands)(this->rawCmd);
if(this->cmd == somfy_commands::RTWProto) {
if(this->encKey >= 160) {
this->proto = radio_proto::RTS;
@@ -165,7 +166,7 @@ void somfy_frame_t::decodeFrame(byte* frame) {
}
else if(this->encKey >= 133) {
this->proto = radio_proto::RTW;
- this->cmd = this->encKey == 133 ? somfy_commands::My : (somfy_commands)(this->encKey - 133);
+ this->cmd = (somfy_commands)(this->encKey - 132);
}
}
else this->proto = radio_proto::RTS;
@@ -4418,6 +4419,11 @@ bool Transceiver::receive(somfy_rx_t *rx) {
//Serial.printf("Processing receive %d\n", rx_queue.length);
rx_queue.pop(rx);
this->frame.decodeFrame(rx);
+ if(this->frame.valid) {
+ ESP_LOGI(TAG, "RX ADDR:%d CMD:%s RAW_CMD:0x%X KEY:0x%02X PROTO:%u",
+ this->frame.remoteAddress, translateSomfyCommand(this->frame.cmd).c_str(),
+ this->frame.rawCmd, this->frame.encKey, (uint8_t)this->frame.proto);
+ }
this->emitFrame(&this->frame, rx);
return this->frame.valid;
}
@@ -4431,6 +4437,7 @@ void Transceiver::emitFrame(somfy_frame_t *frame, somfy_rx_t *rx) {
json->addElem("address", (uint32_t)frame->remoteAddress);
json->addElem("rcode", (uint32_t)frame->rollingCode);
json->addElem("command", translateSomfyCommand(frame->cmd).c_str());
+ json->addElem("rawCmd", frame->rawCmd);
json->addElem("rssi", (int32_t)frame->rssi);
json->addElem("bits", rx->bit_length);
json->addElem("proto", static_cast(frame->proto));
diff --git a/src/Somfy.h b/src/Somfy.h
index 6630db6..b70163e 100644
--- a/src/Somfy.h
+++ b/src/Somfy.h
@@ -189,6 +189,7 @@ struct somfy_frame_t {
uint8_t bitLength = 56;
uint16_t pulseCount = 0;
uint8_t stepSize = 0;
+ uint8_t rawCmd = 0;
void print();
void encode80BitFrame(byte *frame, uint8_t repeat);
byte calc80Checksum(byte b0, byte b1, byte b2);