[RELEASE]Node Red Server Information Driver

This driver can be used to create a virtual device to store and display information from from node-red-contrib-device-stat and node-red-contrib-cpu, in a fashion similar to the Hub Information Driver.

Driver is available in HPM or can be imported directly from https://raw.githubusercontent.com/thebearmay/hubitat/main/nrServerInfo.groovy

Node Red flow input flow:

Flow JSON
[
 [
    {
        "id": "4d61cafd5eccfdd3",
        "type": "tab",
        "label": "Synology Stats",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "2eea6be6851faff2",
        "type": "DeviceStats",
        "z": "4d61cafd5eccfdd3",
        "name": "",
        "mem": true,
        "nw": true,
        "load": true,
        "hostname": true,
        "useString": true,
        "x": 490,
        "y": 160,
        "wires": [
            [
                "1b5bd3141e5c2e34"
            ]
        ]
    },
    {
        "id": "852338c59dc298d2",
        "type": "cpu",
        "z": "4d61cafd5eccfdd3",
        "name": "CPU Usage",
        "msgCore": false,
        "msgOverall": true,
        "msgArray": false,
        "msgTemp": false,
        "x": 490,
        "y": 80,
        "wires": [
            [
                "18feb93ea312994d"
            ]
        ]
    },
    {
        "id": "e8da9d6dc02b2368",
        "type": "inject",
        "z": "4d61cafd5eccfdd3",
        "name": "10min Interval",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "600",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 120,
        "y": 80,
        "wires": [
            [
                "852338c59dc298d2",
                "0eefc3afe00224af",
                "2eea6be6851faff2"
            ]
        ]
    },
    {
        "id": "8cc82100a77843da",
        "type": "hubitat command",
        "z": "4d61cafd5eccfdd3",
        "deviceLabel": "!syn",
        "name": "cpuUsage",
        "server": "d76c8fe2b1ed71b7",
        "deviceId": "15",
        "command": "setUsage",
        "commandArgs": "",
        "x": 960,
        "y": 60,
        "wires": [
            []
        ]
    },
    {
        "id": "18feb93ea312994d",
        "type": "change",
        "z": "4d61cafd5eccfdd3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "arguments",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 710,
        "y": 80,
        "wires": [
            [
                "8cc82100a77843da"
            ]
        ]
    },
    {
        "id": "0eefc3afe00224af",
        "type": "cpu",
        "z": "4d61cafd5eccfdd3",
        "name": "CPU Temperature",
        "msgCore": false,
        "msgOverall": false,
        "msgArray": false,
        "msgTemp": true,
        "x": 510,
        "y": 120,
        "wires": [
            [
                "8429f6fa65e4cfba"
            ]
        ]
    },
    {
        "id": "8429f6fa65e4cfba",
        "type": "change",
        "z": "4d61cafd5eccfdd3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "arguments",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 710,
        "y": 120,
        "wires": [
            [
                "53f606ac113e4c74"
            ]
        ]
    },
    {
        "id": "53f606ac113e4c74",
        "type": "hubitat command",
        "z": "4d61cafd5eccfdd3",
        "deviceLabel": "!syn",
        "name": "setTemp",
        "server": "d76c8fe2b1ed71b7",
        "deviceId": "15",
        "command": "setTemp",
        "commandArgs": "",
        "x": 960,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "1b5bd3141e5c2e34",
        "type": "change",
        "z": "4d61cafd5eccfdd3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "arguments",
                "pt": "msg",
                "to": "payload",
                "tot": "msg",
                "dc": true
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 710,
        "y": 160,
        "wires": [
            [
                "67c296995a55a45f"
            ]
        ]
    },
    {
        "id": "67c296995a55a45f",
        "type": "hubitat command",
        "z": "4d61cafd5eccfdd3",
        "deviceLabel": "!syn",
        "name": "jsonUpdate",
        "server": "d76c8fe2b1ed71b7",
        "deviceId": "15",
        "command": "jsonUpdate",
        "commandArgs": "",
        "x": 970,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "ada3746b87bdad74",
        "type": "hubitat device",
        "z": "4d61cafd5eccfdd3",
        "deviceLabel": "!syn",
        "name": "Refresh Request",
        "server": "d76c8fe2b1ed71b7",
        "deviceId": "15",
        "attribute": "refreshRequested",
        "sendEvent": true,
        "x": 110,
        "y": 200,
        "wires": [
            [
                "33388a5b6a96bf49"
            ]
        ]
    },
    {
        "id": "33388a5b6a96bf49",
        "type": "switch",
        "z": "4d61cafd5eccfdd3",
        "name": "True",
        "property": "payload.value",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 150,
        "y": 140,
        "wires": [
            [
                "0eefc3afe00224af",
                "852338c59dc298d2",
                "52783f592a136e79"
            ]
        ]
    },
    {
        "id": "52783f592a136e79",
        "type": "change",
        "z": "4d61cafd5eccfdd3",
        "name": "inject TS",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "",
                "tot": "date"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 300,
        "y": 200,
        "wires": [
            [
                "2eea6be6851faff2",
                "0eefc3afe00224af",
                "852338c59dc298d2"
            ]
        ]
    },
    {
        "id": "d76c8fe2b1ed71b7",
        "type": "hubitat config",
        "name": "Hubitat Spare",
        "usetls": false,
        "host": "192.168.3.38",
        "port": "80",
        "appId": "14",
        "nodeRedServer": "http://192.168.3.60:6335",
        "webhookPath": "/hubitat/webhook__",
        "autoRefresh": true,
        "useWebsocket": false,
        "colorEnabled": false,
        "color": "#ace043"
    }
]
6 Likes

Hi @thebearmay ,
When using HPM to install the driver it is not available until you run Repair. I remember this was an issue with the Hubinfo V3 driver s well. after the repair it available.

Thank you for this .... :slight_smile:

Tried importing Flow

Got this

If I not doing something wrong then you Flow Jason does not include the Hubitat nodes.
I might need help with the more complex node jsonUpdate.

I think you have copied some text out of the text box. try taking away the part from the 2 sign to the reply word

1 Like

Just caught a small error, if you do an HPM Repair (or a reimport) it should correct it.

You were right - my bad thanks

This is my RPI.

I am happy.

1 Like

By the way what is the difference between cpuUsage and cpuLoad.
I am putting this attribute on the same chart as HubInfo's cpuPct - what attribute should I chose?

The usage appears to be a percentage

1 Like

Added the Refresh capability to the driver to allow the hub to request an update from Node-Red. This also requires a small change to the Node-Red flow (changes are reflected in the first post) to capture and act on the request.

1 Like

Hi @thebearmay ,
Tried the new version but I think I am missing something in the NR side. The code you attached for the NR in the first post seems partial. Can you please review?

Realized that last night and changed the JSON file to include an additional change node after the switch node. Change node just issues a timestamp - seems the DeviceStats node was interpretting the “true” as a request for the uptime only.

I am sorry but I can not seem to get it working for me.
The Json in the first post is showing only the relevat part for the set msg.payload node:

Also, when clicking 'refresh' at the device page in HE the rereshRequested attribute remains true:
image
Is it OK?

If it remains true then it hasn’t recieved a new push of data…

I reposted the flow JSON

OK. FInally got it working.
I had to allow 'Post location events' in Maker API.
For some reaon it was turned off and the refresh comand did not go through to NR.
Thanks,

1 Like