Raspberry Pi 4 on RaspbianOS 64bit (Bullseye), error on system date/time and cpu temp in NodeRed

I know this question is a bit specific to the RaspberryPi, so I'll save you the trouble and perform my own countdown 3-2-1-'This is not the correct forum'. Ok, we got that over with...

I'm using some system level calls that worked under 32bit Rasbian for cpu temp and date/time, that now show errors in my flows since moving to 64bit. It's not an individual Raspbeery Pi 4, because I've noted this on all 3 of them that I've moved to 64bit. Of course, it doesn't matter whether it is NR2.2 or NR3.0 either.

I'm attaching a relevant portion of a flow. If anyone has any experience using a different call to the OS to retrieve this info, I'd be happy to hear it. A search of the interwebs and raspberrypi.org hasn't turned it up yet.

[
    {
        "id": "32e85cb9.0ed214",
        "type": "ui_gauge",
        "z": "3f37d719.465238",
        "name": "",
        "group": "f80a77fc.7bfd48",
        "order": 3,
        "width": "0",
        "height": "0",
        "gtype": "gage",
        "title": "Temp",
        "label": "°C",
        "format": "{{ msg.payload }}",
        "min": 0,
        "max": "100",
        "colors": [
            "#0080ff",
            "#ffffff",
            "#ca3838"
        ],
        "seg1": "70",
        "seg2": "85",
        "x": 970,
        "y": 320,
        "wires": []
    },
    {
        "id": "67c10026.dff9b",
        "type": "exec",
        "z": "3f37d719.465238",
        "command": "/opt/vc/bin/vcgencmd measure_temp | egrep -o \"[0-9]+\\.[0-9]+?\"",
        "addpay": false,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "read_T",
        "x": 440,
        "y": 340,
        "wires": [
            [
                "32e85cb9.0ed214",
                "6b5d2a8.32938d4"
            ],
            [],
            []
        ]
    },
    {
        "id": "6b5d2a8.32938d4",
        "type": "ui_chart",
        "z": "3f37d719.465238",
        "name": "",
        "group": "8ff93c29.cf607",
        "order": 3,
        "width": 0,
        "height": 0,
        "label": "Temperature",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": "5",
        "removeOlderPoints": "",
        "removeOlderUnit": "60",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "x": 990,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "306ba876.1976e8",
        "type": "function",
        "z": "3f37d719.465238",
        "name": "convert_uptime",
        "func": "var d = Math.floor(msg.payload.uptime / 86400);\nvar h = Math.floor((msg.payload.uptime % 86400) / 3600);\nvar m = Math.floor(((msg.payload.uptime % 86400) % 3600) / 60);\nmsg.payload = d + ' ds, ' + h + ' hrs, ' + m + \" mins\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 720,
        "y": 280,
        "wires": [
            [
                "54b4b30e.7c586c"
            ]
        ]
    },
    {
        "id": "54b4b30e.7c586c",
        "type": "ui_text",
        "z": "3f37d719.465238",
        "group": "c3eb3b68.6cab88",
        "order": 3,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Uptime:",
        "format": "{{ msg.payload }}",
        "layout": "row-spread",
        "x": 980,
        "y": 280,
        "wires": []
    },
    {
        "id": "8f1255d5.4d53a8",
        "type": "exec",
        "z": "3f37d719.465238",
        "command": "sudo",
        "addpay": false,
        "append": "hwclock -r",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "Read RTC",
        "x": 450,
        "y": 220,
        "wires": [
            [
                "1680ffd6.fdf3e"
            ],
            [],
            []
        ]
    },
    {
        "id": "98eb022a.a015e",
        "type": "ui_text",
        "z": "3f37d719.465238",
        "group": "c3eb3b68.6cab88",
        "order": 1,
        "width": 0,
        "height": 0,
        "name": "Date",
        "label": "Date:",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "x": 970,
        "y": 200,
        "wires": []
    },
    {
        "id": "c2b110a.e0f76f",
        "type": "inject",
        "z": "3f37d719.465238",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "60",
        "crontab": "",
        "once": true,
        "onceDelay": "5",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 170,
        "y": 300,
        "wires": [
            [
                "67c10026.dff9b",
                "e06f3b3a.a55078",
                "8f1255d5.4d53a8"
            ]
        ]
    },
    {
        "id": "aabab962.4fcef8",
        "type": "ui_text",
        "z": "3f37d719.465238",
        "group": "c3eb3b68.6cab88",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "Time",
        "label": "Time:",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "x": 970,
        "y": 240,
        "wires": []
    },
    {
        "id": "1680ffd6.fdf3e",
        "type": "function",
        "z": "3f37d719.465238",
        "name": "extract",
        "func": "var msg1,msg2;\n\nmsg1 = {topic: \"\", payload: msg.payload.slice(0,10)};\nmsg2 = {topic: \"\", payload: msg.payload.slice(11,16)};\n\nreturn [msg1,msg2];",
        "outputs": 2,
        "noerr": 0,
        "x": 690,
        "y": 220,
        "wires": [
            [
                "98eb022a.a015e"
            ],
            [
                "aabab962.4fcef8"
            ]
        ]
    },
    {
        "id": "e06f3b3a.a55078",
        "type": "Uptime",
        "z": "3f37d719.465238",
        "name": "",
        "x": 440,
        "y": 280,
        "wires": [
            [
                "306ba876.1976e8"
            ]
        ]
    },
    {
        "id": "f80a77fc.7bfd48",
        "type": "ui_group",
        "name": "CPU1",
        "tab": "8b86ff8f.9e36e",
        "order": 1,
        "disp": false,
        "width": "6",
        "collapse": false
    },
    {
        "id": "8ff93c29.cf607",
        "type": "ui_group",
        "name": "History1",
        "tab": "8b86ff8f.9e36e",
        "order": 2,
        "disp": false,
        "width": "6",
        "collapse": false
    },
    {
        "id": "c3eb3b68.6cab88",
        "type": "ui_group",
        "name": "System",
        "tab": "e7d26a0a.64d758",
        "order": 4,
        "disp": false,
        "width": "12",
        "collapse": false
    },
    {
        "id": "8b86ff8f.9e36e",
        "type": "ui_tab",
        "name": "System1",
        "icon": "memory",
        "order": 9,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "e7d26a0a.64d758",
        "type": "ui_tab",
        "name": "System2",
        "icon": "power_settings_new",
        "order": 10,
        "disabled": false,
        "hidden": false
    }
]

Waht happens if you run it in the CLI?
What happens if you move the measure_temp | egrep -o "[0-9]+\.[0-9]+?" to the 'extra input parameters' section?

1 Like

thank you. apparently the file path for vcgencmd had changed. your suggestion, without "/opt/vc/bin/" worked. I also moved the paramets to the 'extra input parameters' text box as well.
Cool! Temperature is fixed.
On to the date/time now.

Ok... fixed... stopped trying to mess around with the RTC... Just fetched date/time from the OS

used sudo date

in a function node parsed out seperate date and time

var msg1,msg2;

msg1 = {topic: "", payload: msg.payload.slice(0,15)};

msg2 = {topic: "", payload: msg.payload.slice(16,21)};

return [msg1,msg2];

Works good.

Did a bit of work on the RaspberryPi4B System Hardware Tab of one of my projects.
I have a newer firmware that allows a bit more overclocking on this particular unit. I'm quite conservative.. So 1.5Ghz to 1.8Ghz on the CPU and 500Mhz to 600Mhz on the GPU and a voltage increase by .1 volts. So, just a 20% increase in clocks.


(this image is taken of a browser window at 800x480 to simulate the official 7" raspberry Pi display)

Here is the flow:
RPi4BSysHWFlow.json (29.2 KB)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.