greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.88k stars 475 forks source link

Temperature block colour ignoring threshold #378

Closed julianneswinoga closed 5 years ago

julianneswinoga commented 5 years ago

i3status-rs-bug

As seen in the image, my thresholds are set and the temperature block is ignoring them and constantly at the red "critical" colour. This issue persists without custom thresholds and just the defaults.

atheriel commented 5 years ago

Are you actually using version 0.9 or are you building from master?

julianneswinoga commented 5 years ago

Ah sorry, I am building from master.

On Sat, May 11, 2019, 11:41 PM Aaron Jacobs notifications@github.com wrote:

Are you actually using version 0.9 or are you building from master?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/greshake/i3status-rust/issues/378#issuecomment-491561835, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMVPDZMDS2UL2U2LHIFKQLPU6GV3ANCNFSM4HL3VUTQ .

julianneswinoga commented 5 years ago

So I found the reason why this is happening. I printed out the temperatures that the block is retrieving from my hardware:

temperatures: [34, 41, 0, 33, 31, 29, 127, 38, 37, 37, 35]
min: 0
max: 127
avg: 40

So even through the text is displaying the average temperature, the minimum and maximum temperatures are erroneous measurements from sensor. The colouring of the block only takes into account the maximum temperature (127), therefore it will always display as the critical colour.

There are temperature limits in place, but they are set to the range [-100, 150] (not sure why these values). I think a reasonable solution would be to change these limits to be user-configurable, or perhaps just to [0, 127].

atheriel commented 5 years ago

The temperature lower bound does seem rather odd, I can't image normal hardware would operate at -100 C. But I do not believe we should attempt to detect fixes for potentially faulty hardware sensors -- that seems to me to belong firmly in the realm of lm_sensors itself.

julianneswinoga commented 5 years ago

Alright, that's a fair decision. I've been reading up on lm-sensors configuration and I see now how to correct for the faulty readings. At first glance as a user this definitely seems like a bug though, on account of how the avg is used for text but max is used for colour.

atheriel commented 5 years ago

I'm quite happy to see additions to the block documentation for these ambiguities, if you're interested in adding to it.