ALLTERCO/shelly-script-examples

router-watchdog.js not working

Closed this issue · 1 comments

Hello,
I am trying to use router-watchdog to ping local web server (Home Assistant in this case). My knowledge of js/C/C++ is very limited...

First issue:
Error code of unresponding server I am getting is -104, not -114 as in example from library. Wouldn't be better to check if response is anything but 0?
Edit: It looks like -114 is for connection refused, -104 is for regular timeout/no response.

Second issue:
Watchdog is not restarted after switch is toggled off and on. I'm trying to figure this one out, but so far no luck.
This condition is never true in my testing:

  if (
    event.name === "switch" &&
    event.info.source === "timer" &&
    event.info.output === false
  ) {

Issue was fixed with PR 24.