send alert from sensor
Hello, i build a sensor and i want to send alert to gateway if problem is detected.
How to send a variable to gateway?
In my mind, i send a variable to gateway and use lua to treat (send a mail for example).
Thank you for your help.
@nico What sort of sensor is it, could you not just use a lua script on the data it is already sending. Another option could be to add a switch (S_BINARY) to the sensor and have your node turn it on if a problem is detected. You could then have your lua code attached to the switch on change event.
it's a door sensor, the sensor test 3 times to activate relay and if nothing happen a variable(alert) is put to 1. I want to send this variable(for example) and generate an alert in lua. If you have another idea..
I was wondering about this but currently don't have any nodes that need to report errors. I thought though I would wrap the error in a string including a prefix as well as importance of the error and send it back to the controller via S_VAR
I use MQTT gateway and I would have NodeRed listen out for any string with the prefix and send me an alert or log the event depending on the importance.
Just an idea at the moment but might help you.