-
Notifications
You must be signed in to change notification settings - Fork 79
Add additional try catch statements #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an async method, so it doesnt throw. Instead, any error is returned through the callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.