From f632dc9c54b1abc1fb1001b3f9b0f9cd733c0c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 29 May 2023 15:14:30 +0200 Subject: [PATCH] Somfy: add initial sun awnings support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Fernández Rojas --- Somfy.cpp | 14 ++++++++++++++ Somfy.h | 3 ++- data/index.html | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Somfy.cpp b/Somfy.cpp index 0397ea2..79251db 100644 --- a/Somfy.cpp +++ b/Somfy.cpp @@ -147,6 +147,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); @@ -280,6 +286,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 +1432,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..def21cc 100644 --- a/Somfy.h +++ b/Somfy.h @@ -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, 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 @@ +