mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 19:12:10 +01:00
Somfy: add initial sun awnings support
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
847a808351
commit
f632dc9c54
3 changed files with 17 additions and 1 deletions
14
Somfy.cpp
14
Somfy.cpp
|
|
@ -147,6 +147,12 @@ void somfy_frame_t::decodeFrame(byte* frame) {
|
||||||
case 140:
|
case 140:
|
||||||
this->cmd = somfy_commands::Prog;
|
this->cmd = somfy_commands::Prog;
|
||||||
break;
|
break;
|
||||||
|
case 141:
|
||||||
|
this->cmd = somfy_commands::SunFlag;
|
||||||
|
break;
|
||||||
|
case 142:
|
||||||
|
this->cmd = somfy_commands::Flag;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->rollingCode = decoded[3] + (decoded[2] << 8);
|
this->rollingCode = decoded[3] + (decoded[2] << 8);
|
||||||
|
|
@ -280,6 +286,12 @@ void somfy_frame_t::encodeFrame(byte *frame) {
|
||||||
case somfy_commands::Prog:
|
case somfy_commands::Prog:
|
||||||
frame[0] = 140;
|
frame[0] = 140;
|
||||||
break;
|
break;
|
||||||
|
case somfy_commands::SunFlag:
|
||||||
|
frame[0] = 141;
|
||||||
|
break;
|
||||||
|
case somfy_commands::Flag:
|
||||||
|
frame[0] = 142;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -1420,6 +1432,8 @@ bool SomfyShade::fromJSON(JsonObject &obj) {
|
||||||
this->shadeType = shade_types::drapery;
|
this->shadeType = shade_types::drapery;
|
||||||
else if(strncmp(obj["shadeType"].as<const char *>(), "blind", 5) == 0)
|
else if(strncmp(obj["shadeType"].as<const char *>(), "blind", 5) == 0)
|
||||||
this->shadeType = shade_types::blind;
|
this->shadeType = shade_types::blind;
|
||||||
|
else if(strncmp(obj["shadeType"].as<const char *>(), "awning", 7) == 0)
|
||||||
|
this->shadeType = shade_types::awning;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->shadeType = static_cast<shade_types>(obj["shadeType"].as<uint8_t>());
|
this->shadeType = static_cast<shade_types>(obj["shadeType"].as<uint8_t>());
|
||||||
|
|
|
||||||
3
Somfy.h
3
Somfy.h
|
|
@ -36,7 +36,8 @@ enum class somfy_commands : byte {
|
||||||
enum class shade_types : byte {
|
enum class shade_types : byte {
|
||||||
roller = 0x00,
|
roller = 0x00,
|
||||||
blind = 0x01,
|
blind = 0x01,
|
||||||
drapery = 0x02
|
drapery = 0x02,
|
||||||
|
awning = 0x03,
|
||||||
};
|
};
|
||||||
enum class tilt_types : byte {
|
enum class tilt_types : byte {
|
||||||
none = 0x00,
|
none = 0x00,
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,7 @@
|
||||||
<option value="0">Roller Shade</option>
|
<option value="0">Roller Shade</option>
|
||||||
<option value="1">Blind</option>
|
<option value="1">Blind</option>
|
||||||
<option value="2">Drapery</option>
|
<option value="2">Drapery</option>
|
||||||
|
<option value="3">Awning</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="selShadeType">Type</label>
|
<label for="selShadeType">Type</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue