diff --git a/Somfy.cpp b/Somfy.cpp index 0397ea2..e59a6eb 100644 --- a/Somfy.cpp +++ b/Somfy.cpp @@ -91,6 +91,8 @@ String translateSomfyCommand(const somfy_commands cmd) { return "Step Up"; case somfy_commands::StepDown: return "Step Down"; + case somfy_commands::Status: + return "Status"; default: return "Unknown(" + String((uint8_t)cmd) + ")"; } @@ -147,6 +149,12 @@ void somfy_frame_t::decodeFrame(byte* frame) { case 140: this->cmd = somfy_commands::Prog; break; + case 141: + this->cmd = somfy_commands::SunFlag; + break; + case 142: + this->cmd = somfy_commands::Flag; + break; } } this->rollingCode = decoded[3] + (decoded[2] << 8); @@ -167,9 +175,12 @@ void somfy_frame_t::decodeFrame(byte* frame) { case somfy_commands::SunFlag: case somfy_commands::Flag: break; + case somfy_commands::Status: + this->rollingCode = 0; + this->status = decoded[3]; + break; case somfy_commands::UnknownC: case somfy_commands::UnknownD: - case somfy_commands::UnknownE: case somfy_commands::RTWProto: this->valid = false; break; @@ -280,6 +291,12 @@ void somfy_frame_t::encodeFrame(byte *frame) { case somfy_commands::Prog: frame[0] = 140; break; + case somfy_commands::SunFlag: + frame[0] = 141; + break; + case somfy_commands::Flag: + frame[0] = 142; + break; } } else { @@ -1420,6 +1437,8 @@ bool SomfyShade::fromJSON(JsonObject &obj) { this->shadeType = shade_types::drapery; else if(strncmp(obj["shadeType"].as(), "blind", 5) == 0) this->shadeType = shade_types::blind; + else if(strncmp(obj["shadeType"].as(), "awning", 7) == 0) + this->shadeType = shade_types::awning; } else { this->shadeType = static_cast(obj["shadeType"].as()); diff --git a/Somfy.h b/Somfy.h index 07455f9..e64a565 100644 --- a/Somfy.h +++ b/Somfy.h @@ -28,7 +28,7 @@ enum class somfy_commands : byte { StepDown = 0xB, UnknownC = 0xC, UnknownD = 0xD, - UnknownE = 0xE, // This command byte has been witnessed in the wild but cannot tell if it is from Somfy. No rolling code is sent with this and it is 56-bits. + Status = 0xE, RTWProto = 0xF, // RTW Protocol // Command extensions for 80 bit frames StepUp = 0x8B @@ -36,7 +36,8 @@ enum class somfy_commands : byte { enum class shade_types : byte { roller = 0x00, blind = 0x01, - drapery = 0x02 + drapery = 0x02, + awning = 0x03, }; enum class tilt_types : byte { none = 0x00, @@ -93,6 +94,11 @@ typedef struct somfy_tx_queue_t { bool pop(somfy_tx_t *tx); bool push(uint32_t await, somfy_commands cmd, uint8_t repeats); }; + +typedef enum { + no_sun = 0, + sun = 2 +} somfy_status_t; typedef struct somfy_frame_t { bool valid = false; bool processed = false; @@ -109,6 +115,7 @@ typedef struct somfy_frame_t { uint32_t await = 0; uint8_t bitLength = 56; uint16_t pulseCount = 0; + somfy_status_t status = no_sun; void print(); void encodeFrame(byte *frame); void decodeFrame(byte* frame); diff --git a/data/index.html b/data/index.html index df71abf..30be104 100644 --- a/data/index.html +++ b/data/index.html @@ -240,6 +240,7 @@ +