mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 11:02:12 +01:00
Somfy: fix Sensor validity w/o sun/wind
If there's no sun/win, the rolling code value will be 0. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
6b4c2241e1
commit
2671c5aa60
1 changed files with 3 additions and 1 deletions
|
|
@ -161,7 +161,9 @@ void somfy_frame_t::decodeFrame(byte* frame) {
|
||||||
}
|
}
|
||||||
this->rollingCode = decoded[3] + (decoded[2] << 8);
|
this->rollingCode = decoded[3] + (decoded[2] << 8);
|
||||||
this->remoteAddress = (decoded[6] + (decoded[5] << 8) + (decoded[4] << 16));
|
this->remoteAddress = (decoded[6] + (decoded[5] << 8) + (decoded[4] << 16));
|
||||||
this->valid = this->checksum == checksum && this->remoteAddress > 0 && this->remoteAddress < 16777215 && this->rollingCode > 0;
|
this->valid = this->checksum == checksum && this->remoteAddress > 0 && this->remoteAddress < 16777215;
|
||||||
|
if (this->cmd != somfy_commands::Sensor)
|
||||||
|
this->valid &= (this->rollingCode > 0);
|
||||||
if (this->valid) {
|
if (this->valid) {
|
||||||
// Check for valid command.
|
// Check for valid command.
|
||||||
switch (this->cmd) {
|
switch (this->cmd) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue