Device connected/disconnected hooks

I am looking for a way to detect if my device is currently connected or disconnected without using DEVICES API. I just don’t want to implement a scheduled job in my third party in order to determine if a device got disconnected for some reason (WIFI failed, power supply failed or something else).

I’ve been searching in the documentation for some kind of hooks that I can define for my devices and every time an event (connected/disconnected) occur, I can handle it on my own endpoint instead of constantly pinging the device through its REST API.

Hi @peepnee, at this moment you can easily do that with the node-red plugin. There is an event that is raised when the device is connected/disconnected, and can be used to call an endpoint easily, i.e., your own endpoint. Moreover, if you can open a websocket against in your host, you can also read such event (for any device). Let me know if it is possible and I will tell you how.

Best regards.

With an ESP8266, you can IMHO just check with millis() how long a thinger handle() takes.
It should run usually under 50mS, even with a lot of stuff to transmit.
If it takes up to 12 seconds, you are (temporarily) disconnected from the Thinger server (for several reasons, which includes disorders from the ISP provider and upstream landscape as well).

I have a number of devices hosted on
Except for that, I also have an endpoint (on my 3rd party service) which expects a device id and event type (connected/disconnected). I am looking for a centralized mechanism which keeps a track of all my devices and once I have any of them connected/disconnected it fires up an event and sends a request to my 3rd party service.

You can easily do that with Node-Red plugin if you have a private server instance.

I just have a regular registration and I only operate on the console there.

I just create devices and once I have the credentials, I add them to the C++ code which is running on my ESP8266 devices.

I can see that there’s a plugins menu on the left and I will experiment with it.