Gnome-shell-system-monitor-applet: Thermal shows NaN since the last update

Created on 2 May 2019  Â·  18Comments  Â·  Source: paradoxxxzero/gnome-shell-system-monitor-applet

Yesterday, I've got an update for this extension. Today, I've noticed that the thermals are only showing NaN (not a number) in the extension. Psensor displays it correctly.

I'm using Ubuntu 18.04 64-bit with kernel 4.15.0-48-generic on an Intel Core i3-2100.

Most helpful comment

Building up on @ibrahimalkurdi 's answer, here's explicitly what you should do:

  1. Open ~/.local/share/gnome-shell/extensions/[email protected]/extension.js in your editor
  2. Change the 3 following lines of code:
  3. frequency:
total_frequency += parseInt(ByteArray.toString(as_r[1]));

to

                let temp_frequency = as_r[1];
                if (!ByteArray.toString(temp_frequency).match(/GjsModule byteArray/))
                    temp_frequency = ByteArray.toString(temp_frequency);
                total_frequency += parseInt(temp_frequency);
  • temperature:
this.temperature = Math.round(parseInt(ByteArray.toString(as_r[1])) / 1000);

to

                let temp_temperature = as_r[1];
                if (!ByteArray.toString(temp_temperature).match(/GjsModule byteArray/))
                    temp_temperature = ByteArray.toString(temp_temperature);
                this.temperature = Math.round(parseInt(temp_temperature) / 1000);
  • rpm:
this.rpm = parseInt(ByteArray.toString(as_r[1]));

to

                let temp_rpm = as_r[1];
                if (!ByteArray.toString(temp_rpm).match(/GjsModule byteArray/))
                    temp_rpm = ByteArray.toString(temp_rpm);
                this.rpm = parseInt(temp_rpm);
  1. Restart your session.

All 18 comments

Same here (Ubuntu 18.04 4.18.0-18-generic) regardless of chosen sensor.

It seems like my Ubuntu 18.04 system has the same issue, but not my Ubuntu 19.04 one.

The Frequency stat seems to have a similar issue on Ubuntu 18.04.

Also seeing NaN in thermals now — regardless of sensor selected.
Ubuntu 18.04.2 LTS. Kernel 4.18.0-18-generic. Gnome 3.28.2.

Also Fan and Frequency show NaN
Ubuntu 18.04.2 LTS Kernel 4.15.0-48-generic gnome 3.28.3

I've confirmed this as well. It looks like the value returned source.load_contents_finish(result)[1] inside the Thermal.refresh() method isn't a simple numeric value.

When I log the value, it appears in syslog as "36000#012", and when I use .toString(), it appears as ", 36000". I could strip out the comma, but that would mean my CPU is at 36000 degrees Celcius, so I'm not sure that would qualify as a fix.

I don't have much experience reading the temperature sensor, as I've never had to. Is that a valid value, possibly meaning my computer doesn't have that sensor and just returns some absurdly high default value?

Nevermind. It looks like this commit is what broke it. I've reverted the use of ByteArray.toString, which has fixed it for me.

@shemgp Do you know why ByteArray doesn't work here?

After I checked out the latest commit, the thermal temperature and fan frequency is fixed for me. However the CPU frequency is still broken showing NaN.

Same here: freq, temp and fan speed are NaN

same here
its show install lm-sensors , but its installed

Finally had time to debug this: In gnome-shell 3.28, when you pass as_r[1] to ByteArray.toString() returns [object GjsModule byteArray], as in, that string. Actually, ByteArray.toString() is not required for it since as_r[1] returns the needed value.

While for newer gnome-shells (I tested, 3.32), ByteArray.toString() returns the same string that was entered, but it is required to use it otherwise there would be a warning (see #504).

So maybe we can have a work around like these?
FROM

            total_frequency += parseInt(ByteArray.toString(as_r[1]));

TO

            let value = as_r[1];
            if (!ByteArray.toString(value).match(/GjsModule byteArray/))
                value = ByteArray.toString(value);
            total_frequency += parseInt(value);

Are there plans to update the version in ubuntu software center with this fix? I have the latest version installed from there and am seeing this issue. Thx!

Just to note, I observed the issue with the extension update on OpenSUSE Leap 15.0 (Gnome 3.26.2), but it works just fine with an up to date OpenSUSE Tumbleweed (Gnome 3.32.2).
The fact that I installed the latter system and extension on it only after it broke on the first one might or might not be relevant.

I tried the mentioned solutions of both @shemgp and @chrisspen on Ubuntu 18.04.1 LTS with gnome-shell version 3.28.3 but It didn't work

I tried the mentioned solutions of both @shemgp and @chrisspen on Ubuntu 18.04.1 LTS with gnome-shell version 3.28.3 but It didn't work

It has been fixed after I rebooted my machine. (it didn't fix by reloading the plugin)
The default file path which needs to be modified:
~/.local/share/gnome-shell/extensions/[email protected]/extension.js

Thanks @shemgp and @chrisspen

Building up on @ibrahimalkurdi 's answer, here's explicitly what you should do:

  1. Open ~/.local/share/gnome-shell/extensions/[email protected]/extension.js in your editor
  2. Change the 3 following lines of code:
  3. frequency:
total_frequency += parseInt(ByteArray.toString(as_r[1]));

to

                let temp_frequency = as_r[1];
                if (!ByteArray.toString(temp_frequency).match(/GjsModule byteArray/))
                    temp_frequency = ByteArray.toString(temp_frequency);
                total_frequency += parseInt(temp_frequency);
  • temperature:
this.temperature = Math.round(parseInt(ByteArray.toString(as_r[1])) / 1000);

to

                let temp_temperature = as_r[1];
                if (!ByteArray.toString(temp_temperature).match(/GjsModule byteArray/))
                    temp_temperature = ByteArray.toString(temp_temperature);
                this.temperature = Math.round(parseInt(temp_temperature) / 1000);
  • rpm:
this.rpm = parseInt(ByteArray.toString(as_r[1]));

to

                let temp_rpm = as_r[1];
                if (!ByteArray.toString(temp_rpm).match(/GjsModule byteArray/))
                    temp_rpm = ByteArray.toString(temp_rpm);
                this.rpm = parseInt(temp_rpm);
  1. Restart your session.

Building up on @ibrahimalkurdi 's answer, here's explicitly what you should do:

1. Open `~/.local/share/gnome-shell/extensions/[email protected]/extension.js` in your editor

2. Change the 3 following lines of code:


* frequency:
total_frequency += parseInt(ByteArray.toString(as_r[1]));

to

                let temp_frequency = as_r[1];
                if (!ByteArray.toString(temp_frequency).match(/GjsModule byteArray/))
                    temp_frequency = ByteArray.toString(temp_frequency);
                total_frequency += parseInt(temp_frequency);
* temperature:
this.temperature = Math.round(parseInt(ByteArray.toString(as_r[1])) / 1000);

to

                let temp_temperature = as_r[1];
                if (!ByteArray.toString(temp_temperature).match(/GjsModule byteArray/))
                    temp_temperature = ByteArray.toString(temp_temperature);
                this.temperature = Math.round(parseInt(temp_temperature) / 1000);
* rpm:
this.rpm = parseInt(ByteArray.toString(as_r[1]));

to

                let temp_rpm = as_r[1];
                if (!ByteArray.toString(temp_rpm).match(/GjsModule byteArray/))
                    temp_rpm = ByteArray.toString(temp_rpm);
                this.rpm = parseInt(temp_rpm);
1. Restart your session.

Your solution worked perfectly on my Ubuntu 18.04 LTS. I installed gnome-shell-extension-system-monitor from the Ubuntu Software Center and I had the NaN problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bendavis78 picture bendavis78  Â·  13Comments

ceyhunn picture ceyhunn  Â·  9Comments

jakethelizard99 picture jakethelizard99  Â·  4Comments

staticdev picture staticdev  Â·  5Comments

tryfon picture tryfon  Â·  5Comments