softypit / esp32_mqtt_eq3

esp32-based mqtt node to control EQ-3 BLE TRVs
145 stars 48 forks source link

Don't enqueue the same command again if it still is the last command #23

Closed Floyddotnet closed 5 years ago

Floyddotnet commented 5 years ago

Since we have a working and good command retry solution, we run in a new issue. If someone sends the command every minute (like unlock) and the trv is far away, we maybe get multiple timeouts until command proceeds. if this needs more then a minute (in this example) the same command is added ever and ever again.

this patch extracts the enqueue code in a new function and makes a simple check. it prevents the command to be added to the queue if it still is the last command for a specific trv.

the code is tested in a stress test with my 2 test trvs for a full hower without any problems.