Somfy: add initial sun awnings support

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
Álvaro Fernández Rojas 2023-05-29 15:14:30 +02:00
parent 847a808351
commit f632dc9c54
3 changed files with 17 additions and 1 deletions

View file

@ -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<const char *>(), "blind", 5) == 0)
this->shadeType = shade_types::blind;
else if(strncmp(obj["shadeType"].as<const char *>(), "awning", 7) == 0)
this->shadeType = shade_types::awning;
}
else {
this->shadeType = static_cast<shade_types>(obj["shadeType"].as<uint8_t>());

View file

@ -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,

View file

@ -240,6 +240,7 @@
<option value="0">Roller Shade</option>
<option value="1">Blind</option>
<option value="2">Drapery</option>
<option value="3">Awning</option>
</select>
<label for="selShadeType">Type</label>
</div>