Closed Tijnert closed 4 years ago
I just installed it, and i got the same problem
This problem was solved here - https://github.com/XavierBerger/RPi-Monitor/issues/245
This problem was solved here - #245
Sadly none of the things in that thread did anything for me. Still got the problem
I had to edit /etc/rpimonitor/template/temperature.conf:
#dynamic.1.postprocess=sprintf("%.2f", $1/1000)
dynamic.1.postprocess=$1/1000
dynamic.1.postprocess=sprintf("%.2f", $1/1000) dynamic.1.postprocess=$1/1000
Thanks. That seem to do the trick :)
Thanks!
@licaon-kter Thanks! Worked perfectly.
Using dynamic.1.postprocess=$1/1000
according to @licaon-kter's suggestion causes the temperature to display three-digit numbers and sometimes overflow the gauge area (see this example).
To fix this, I changed the web to show only two digits. I.e. change from:
web.status.1.content.1.line.1=JustGageBar("CPU Temperature", data.soc_temp+"°C", 40, data.soc_temp, 80, 100, 80)
to:
web.status.1.content.1.line.1=JustGageBar("CPU Temperature", data.soc_temp+"°C", 40, data.soc_temp.toFixed(2), 80, 100, 80)
I added .toFixed(2)
in the number displayed in the center of the gauge.
@dineiar I added .toFixed(2) as above but it returns an error.
JustGageBar("Voltage","V",0,data.volts.toFixed(2),4,100,80,"",50,75) -> TypeError: data.volts.toFixed is not a function
@racedowling, how is the volts
information defined in your config file?
The original CPU template only contains a field called cpu_voltage
.
@dineiar I used volts so that I wouldn't have to change the working cpu_voltage. I went through and changed everything to cpu_voltage but the result was the same.
" + JustGageBar("Voltage","V",0,data.cpu_voltage.toFixed(2),4,100,80,"",50,75) -> TypeError: data.cpu_voltage.toFixed is not a function
I don't know if this makes a difference but this is how I'm setting the variable: dynamic.3.name=cpu_voltage dynamic.3.source=vcgencmd measure_volts core dynamic.3.regexp=volt\=(.*)V dynamic.3.postprocess=$1 dynamic.3.rrd=GAUGE
The other fix - int($1/100+0.5)/100 works in rpimonitord -i but in the config file it only returns 0.
It's ok to use your own variables, I also do this all the time.
My guess is that the error is because your variable is being passed to JavaScript as an string
and toFixed
is a method of the number
prototype. I see two options to fix it:
postprocess
to perform any computation (e.g. postprocess=$1/1
should be enough).toFixed
, i.e. parseFloat(data.cpu_voltage).toFixed(2)
IMHO, I prefer the first option, but maybe you will need to erase your database if you go with it, because I'm not sure if the backend stores schema/column types.
@dineiar The divide by 1 worked! (Tip of my hat to you). Thanks, this has been driving me crazy since upgrading from 12. I earlier tried *1 which did not. Strange error message for a type mismatch.
Hi,
Installed RPI-Monitor with the default temperature.conf file. The Temperature doesn't show up .
content conf file: