Hi guys, I'm brand new to Node Red and learning linux command line on the fly. I have come up with a command that returns my CPU Temp. I'm trying to implement this for an ARM64 CPU piece of hardware.
After having weird results in Node Red I decided to test this same code on my laptop running Ubuntu 20.04 with Node Red as the local host and get the same result of 0 C. This is just the start of a dashboard with lots of hardware info but I've been stumped since this works just fine when I enter it in the shell on two different systems, both debian based. Both terminals give me somewhere between 30 - 45 C which I feel is fairly reasonable.
My gut says Exec Node doesn't recognize the cputemp variable?
cputemp=$(</sys/class/thermal/thermal_zone0/temp) && echo "$((cputemp/1000)) c"
I've also tried just to read the raw data and this does work in Exec Node:
cat /sys/class/thermal/thermal_zone0/temp
Here is my Flow:
[{"id":"ae9aa0fe.aa951","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"90cedbc2.449788","type":"inject","z":"ae9aa0fe.aa951","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":140,"wires":[["daeb5567.14cd78"]]},{"id":"daeb5567.14cd78","type":"exec","z":"ae9aa0fe.aa951","command":"cputemp=$(</sys/class/thermal/thermal_zone0/temp) && echo \"$((cputemp/1000)) c\"","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"CPU Temp","x":290,"y":140,"wires":[["29dc069.cfc19fa"],[],[]]},{"id":"29dc069.cfc19fa","type":"debug","z":"ae9aa0fe.aa951","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":490,"y":140,"wires":[]}]```