node-red-contrib-notification-center

0.0.2 • Public • Published

pipeline status npm @latest npm downloads license

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.

Example flow

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;

Package Sidebar

Install

npm i node-red-contrib-notification-center

Weekly Downloads

10

Version

0.0.2

License

Apache-2.0

Unpacked Size

75.1 kB

Total Files

12

Last publish

Collaborators

  • myplacedk