Somebody could help. I need to configure a status alert email when my ESP32 become offline. is possible to include this functionality as End Point? How could I configurate it?
This is an interesting doubt! Thinger.io Server creates an internal event when any device status is modified. This event can be triggered with Node-RED plugin creating a simple flow as shown in the image below:
This implementation only can made if you are working with a private instance, as you need to deploy the Node-RED plugin, and there is not any tool on the main platform that allows triggering this event to call an endpoint yet.
Hi @BFD, that is a private instance exclusive feature, at the public server no user is allowed to do it, that’s why you get that error.
There is another way but you need to use another device that consult the ESP’s status by its api, a kind of “watchdog device”.
Here you can find the documentation about the device’s api (to consult the ESP’s status):
And here there is a post about how to read data from buckets:
You may apply the same method to read the ESP’s api, what you need is to determinate in the array of devices, how to identify which one is online and which is offline, and trigger the endpoint with the alert from the “watchdog device”, and of course you need to warranty that the watchdog is always online (that have power supply and internet access), and code to execute the consult to online devices every timelapse you consider appropriate.
using node-RED is quite simple, you don’t have to program anything, just place the two nodes and configure it in order to detect the device you wan’t to monitor (or every devices if you don’t select an specific one in the server_event node) and then, placing the second node with the endpoint call you can send the notification to an email address or telegram.
Place a “Server_event” node, and select the event “type”:Device_state_change, then in the “device” section you can place the ID of the device you want to monitor (or leave it empty if you want to monitor the whole network). Finally, select the “state” you want to monitor Connections, Disctonnections or Any depending on your requirements.
Placing a second node with Endpoint call function, it is possible to send this JSON to an endpoint, allowing to alert us via telegram or email working with the device data. As you can see in the image below, I’m going to name my new endpoint with the ID: “alert”
Now we can go to Thinger Endpoints section and create the “alert” email endpoint (4example). Note that we can use the JSON variables using double keys {{device}}, to feed the text:
That way, according to the Json example that I wrote before, I will receive the next email “The device Device_1 is now Connected”