Status email alert

Hello;

I new here and I’m learning about Thinger.io.

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?

Thank you in advance!

Hello @BFD,

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.

Hope it helps

Hello @JorgeTrincado,

Thank you for your help. So can I install the Node-RED on free Thinger.io access?
I tried install the plugin, but I got an Error 400.

Best,

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):
https://docs.thinger.io/server/api#get-device-stats

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.

It is a far-fetched method but it can be applied :wink:

Regards,

i have a private on, but i don’t have experience with Node, could you explain it in steps?

Hi @Moahmed_ELnahas ,

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.

You can find additional information and also JSON to import the node into your node-RED in the documentation: https://docs.thinger.io/plugins/node-red#useful-example-flows

Hope it helps!

i can’t find these under can you show them please by picture please.

i tried to copy it but there an error

Hello @Moahmed_ELnahas,

Ok, we will try to go step by step:

  1. 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.


Note that you will need to configure your Thinger as explained in the documentation.

This node will trigger the connection/disconnection events throwing the next JSON each time it is executed:

payload: object{
device: "Device1",
event: "device_state_change",
state: "connected",
ts: 1605714426672,
user: "jt"`
}
  1. 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”

  2. 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:

image

That way, according to the Json example that I wrote before, I will receive the next email “The device Device_1 is now Connected”

Hope it helps