Conversation
Rapid state changes of the wall dimmer switch causes the code to fail. Additional try/catch statements prevent the code from crashing.
|
I have been running this version of code for several months now with no code crashes. |
|
What is required to get this pull request merged to the main branch? |
taulfsime
left a comment
There was a problem hiding this comment.
hi,
can you post some example of the errors you are getting (with the original version of the script)?
|
|
||
| Shelly.call("KVS.Set", kvpData, cb); | ||
| try { | ||
| Shelly.call("KVS.Set", kvpData, cb); |
There was a problem hiding this comment.
this is an async method, so it doesnt throw. Instead, any error is returned through the callback.
There was a problem hiding this comment.
Spamming the buttons on two switches, after fixing the error that occurs from line 205/213, I get this exception
Exception shown by UI
✕ Uncaught Error: Too many calls in progress at Shelly.call("KVS.Set", kvpData, cb); ^ in function "updateLocalKVS" called from updateLocalKVS(currentStatus); ^ in function called from system
Additional details from logs output
Running setLocalDimmerStatus 01:03:30 {"on":true,"brightness":3} 01:03:30 Error: Set light status: Error: Error: Too many calls in progress 01:03:30 Status Handler intercept : {"component":"sys","name":"sys","id":-1,"delta":{"kvs_rev":188}} 01:03:30 Key Value Store has been updated 01:03:30 Update local setting 01:03:30 Running UpdateLightState: 01:03:30 ^ 01:03:30 in function "updateLocalKVS" called from updateLocalKVS(currentStatus); 01:03:30 ^ 01:03:30 in function called from system
| // Send data to all remote (skip the local IP) | ||
| if (CONFIG.dimmerGroup[i] !== CONFIG.wifiIP) { | ||
| currentStatus.ip = CONFIG.dimmerGroup[i]; | ||
| syncKVSToDimmer(currentStatus); |
There was a problem hiding this comment.
I don't have those detail any longer. I'll have to see if I can reproduce, most of the testing that revealed where to add the try statements dealt with hitting multiple switches repeatedly.
Rapid state changes of the wall dimmer switch causes the code to fail. Additional try/catch statements prevent the code from crashing.