Where to start debugging when things don't update

Hi all,
I’m pretty new to the Mozilla IoT/WebThings and started to create a bunch of own sensors (ESP32/ESP8266 based, so I’m using the Arduino WebThing lib and version 0.9.2 of the gateway).

I noticed very strange behaviour of the Temperature und MultiLevel Sensors (e.g. only the latest LevelProperty that was added gets updated - I worked around this problem by simply having multiple devices on a single adapter). However, I noticed that at some point all sensors that I created stop updating (reproducible). I didn’t find a pattern yet when this happens, but the experimental logs feature clearly show that at some point they simply stop updating and so do the downloadable logs- although the devices are still reachable (http://IP/things/DeviceName/properties).

I’m a bit lost on how to debug this without any logs showing a device failure or the devices being unreachable, they are still accessible and provide valid data. Any hints on how I can figure out why the gateway stops updating the things? In some cases the devices start to update again after hours, in other cases they don’t or just some of them (even though they are served by the same adapter on the same device and still providing valid data). Is there any way to find out why a thing wasn’t updated anymore? Frankly speaking, I didn’t figure out yet if a call to adapter->update() pushes the values to the gateway or if the gateway pulls the data regularly and the call just updates the internal data structure that is being published.

I’ll file issues for it once I’m able to confirm it’s really a problem with the gateway and not with my code.

I’m very grateful for any hints. Thanks for all the effort you put into the project so far, great work, I love it!

Thanks,
Chris

Is there anything relevant in your log files? It would probably be prefixed by “thing-url”.

You can find the log files in ~/.mozilla-iot/log or in the UI via Settings -> Developer -> View Internal Logs.

I think I found the problem by accident… it seems to be related to mDNS and caused by my router.
The logs didn’t give anything useful other than no more logs for the devices - at some point it simply stopped. Is there anyway to see when the gateway tried to reach the devices the last time? What happens exactly when you fire adapter->update()?

No, I don’t believe that adapter logs anything when it’s polling, but you could add a log if you want.

  • mkdir ~/.mozilla-iot/addons/thing-url-adapter/.git
  • Add a console.log() in poll() in ~/.mozilla-iot/addons/thing-url-adapter/thing-url-adapter.js
  • Disable the “Web Thing” add-on in your UI, wait a few seconds, then re-enable it.

Excellent, this is where the actual adapter code is… I’ll try to debug from here and will update the thread once I found the problem.

Cheers! Dank Dir!