HorlogeSkynet / archey4

:computer: Maintained fork of the original Archey (Linux) system tool
https://git.io/archey4
GNU General Public License v3.0
295 stars 37 forks source link

[QUESTION] Adds support for temperature ? #10

Closed HorlogeSkynet closed 6 years ago

HorlogeSkynet commented 6 years ago

Hey visitor / user !

I'm thinking about adding a new entry for hardware temperature.


This is what it would do :


Some questions still opened for you :

  1. Default unit ?
    • [X] Celcius
    • [ ] Fahrenheit
  2. Do we let the user change it easily with a new constant in the header ?
    • [X] Yes
    • [ ] No
  3. Do you know some other existing files to fetch interesting values ?
    • [ ] Yes
    • [ ] No
  4. Do we add a dependency to lm-sensors or would we be satisfied with files listed above ?
    • [ ] Yes and no
    • [x] No and yes
  5. Do we average each existing value, or only keep the maximum ?
    • [ ] Yes
    • [ ] No
    • [X] Both when possible
  6. Do you want such a feature ?
    • [ ] Yes
    • [ ] No

Authentic or future users, feel free to discuss this below 👌

Bye 👋

adjagu commented 6 years ago

I have a few Raspberry's laying around here that I would use this on.

As to your questions:

  1. Celsius as default with option of easily switching to Fahrenheit. Reasoning being the majority of the world uses Celsius.
  2. Check the two following links for more available options for Raspberry Pi's. a. https://elinux.org/RPI_vcgencmd_usage b. https://github.com/nezticle/RaspberryPi-BuildRoot/wiki/VideoCore-Tools
  3. Not sure.
  4. Could we have both and add one? a. Store and then display the maximum temp reached. b. Display averaged temperature spanning x amount of time. c. Display current temperature.
  5. I would use this on my Raspberry Pi's. That being said I do question whether or not if this would be better on its own? The majority (possibly all) of Raspberry Pi related system information would not be of use to me on my daily desktop system as it is not ARM based.
HorlogeSkynet commented 6 years ago

Hey @AdJaGu, glad to hear from you !

1 Okay so this point is checked (I've modified the OP to transform points into checklist) 2 Yeah we'd be definitely using the measure_temp option of vcgencmd, as it's the only temperature-relative command 4 I don't entirely get what you meant there, but I disagree with time-based computations as Archey executions are not "persistent" 5 Actually I'd like to make this feature working with Laptop / Desktop systems (without vcgencmd) too (with the help of the files present within the second path). It would be based on simple computations with values contained there

I could push a new branch with a first prototype, to support further discussion. I'd like to hear other voices too !

@++ 👋 Samuel


EDIT : I've got a working branch ! But there is a problem with the '°' character with locales not supporting unicode (like my Raspberry's)... Related to #5 So are we supposed to display temperatures with 'oC' or 'oF' ? Another problem : Opening and reading these files is slow... It'll be ~250 ms slower, so this is acceptable I think... Thanks !

On my Raspberry :

image

On my laptop :

image

Tell me what you think about that 👌

HorlogeSkynet commented 6 years ago

There is a branch to test this feature : feature/temperature

I'd wait for many opinions before merging that. For now, your feedbacks are welcome !

adjagu commented 6 years ago

Got my Pi 3 with fresh Raspbian on it and have tested this and it works well and runs fast.

Time to execute the script on Pi 3:

Time to execute script on Desktop:

On my Pi 3 I was able to get the degree symbol to display by using ctrl-shift-u + 00b0. https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block) The below picture shows archey after having applied my edits to it. If this works for you too, would this fix #5? raspbian

I have added a pull request with the changes I made. Pull #11

HorlogeSkynet commented 6 years ago

Hey @AdJaGu, thanks for your answer !

I'll bring new changes to the branch soon : CPU and GPU distinct temperatures for Raspberry

I'm starting to think also to really externalize these top "options", maybe another branch in the future ?

Bye 👋

adjagu commented 6 years ago

Would \xb0F and \xb0C work and still be backward compatible?

HorlogeSkynet commented 6 years ago

I'm really not an encoding expert, but the thing is these are just ways to display the same character, but non-Unicode locales can't display Unicode characters...

adjagu commented 6 years ago

@HorlogeSkynet I am not familiar with encoding either. I have always used en_US.UTF-8.

If Unicode is not guaranteed then I would use one of the following and drop ° completely.

Temperature: 54.8 C or Temperature 54.8 Celsius.

HorlogeSkynet commented 6 years ago

Yeah we totally can. vcgencmd formats the output as XX'C (surely for the same reason as above...).

We just have to make a choice then !

HorlogeSkynet commented 6 years ago

Okay we are getting closer to a feature merging with 0ae471ccdb7d1d3ab0209123fa822bdd0c76e29f. Maybe we should wait a bit for other advices or comments ?

Any feedback would be good anyway, bye 👋

HorlogeSkynet commented 6 years ago

Closing here as PR opened (#12)