Hi all,
I have read through a few posts on the forum on how to trigger something from an ouput of a function JS function. Maybe I am even thinking of this the wrong way. Let me give you an example of what I am trying to do:
- I am monitoring a topic from a MQTT service. The topic provides me a value of voltage of the grid.
- What I am trying to do is I have some really simple code:
var payload = msg.payload
if (payload > 225) {
msg.payload = "GridUp";
node.status({fill:"green",shape:"dot",text:"connected"});
} else if (payload < 200) {
msg.payload = "GridDown";
node.status({fill:"red",shape:"ring",text:"disconnected"});
}
return msg;
What I want to achieve is if the value is below 200 I want to trigger a notification through a notification service. So its quite a simple check if I am below 200 (volts) send notification, if above just show connected.
So my question(s) would be:
- Is the function node the right node to do this with (for my own learning and future requirements)
- If it is how would I trigger sending a notification (I use pushsafer and use this a lot so would just need to know how to trigger that node)
- If the function node isn't the right node then what would be?
Thanking you