shelly-script-examples
shelly-script-examples copied to clipboard
Minor error in example remoterpc.js
I think that in line 54 the parameter error_message should be error_code to reflect the argument in the declaration of the function in line 53.
...and similarly for line 62 and 61.
Another matter - just a suggestion:
Regarding lines 23-25: These lines rely on the variable result being an object with certain properties. However, if Shelly.call, which is executing the callback code fails - e.g. because the remote Shelly device is temporarily unavailable (e.g. WiFi being down) - result is null or undefined and the script will stall.
The example code works for illustration of certain aspects, but perhaps a note/comment to add error handling in a "production environment" would be an idea?