node-red-contrib-notification-center 0.0.2
Node-RED notification hub. A single place to send all notifications through, so they can all be handled in a consistent way.
node-red-contrib-notification-center
Node-RED notification hub.
A single place to send all notifications through, so they can all be handled in a consistent way.
Install
Run the following command in your Node-RED user directory - typically ~/.node-red
npm install node-red-contrib-notification-center
Examples
Example 1: Complete flow
You can get the complete flow from the illustration by opening Node Red, open the hamburger menu (top right corner), choose Import -> Examples -> notification center -> Complete flow.
Example 2: Parsing data into notifications
Here msg.payload
contains various status information about my heater. This function
transforms the most important
data into notifications according to my preferences.
const pelletsLow = msg.payload.hopperDaysLeft <= 2 || msg.payload.hopperContentKg < 20;
msg.payload = [
{
"category": "stoker",
"key": "alarm",
"severity": "high",
"text": msg.payload.alert ? msg.payload.stateText : null
},
{
"category": "stoker",
"key": "hopperWarning",
"severity": "medium",
"text": pelletsLow ? "About " + msg.payload.hopperDaysLeft + " days of pellets left" : null
},
{
"category": "stoker",
"key": "state",
"severity": "low",
"text": msg.payload.stateText
}
]
return msg;