Add option to thermal plugin to show first decimal place #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The major point of this PR is to add an option to show a single decimal place in the temperature display. While most sensors only yield integer values, there are some which at least can supply 0.5 increments.
Current Behavior
Updated Behavior
Minor Addition: Support for OTHER input files
This PR also adds logic to use an arbitrary file as sensor (called
raw
in the code), which works the same as reading a temperature from a file under/sys/class/thermal
. Reading from arbitrary locations was already possible before by exploiting the logic, as the checks would treat a folder at an unexpected path as if it were under/proc/
. You could previously e.g. create a file under/home/alice/mysensors/temperature
with this content:and point the plugin to
/home/alice/mysensors
to read this 80 C value. The new behavior is to first check for the/sys/
and/proc
prefixes explicitly, and if none applies, treat the passed path as a filepath with a format as used in/sys/class/thermal
. You can e.g. create the file/home/alice/outside_temp
with the contentand pass the full path
/home/alice/outside_temp
to read this as 25.3 C. This can be paired with a background script to e.g. query non-internal sensors, web-APIs etc.Minor Addition: Disambiguate temperatures from error code
Currently, temperature-returning functions return -1 upon error. While internal sensors will usually not encounter negative temperatures, this may be ambiguous now that we support OTHER files. Therefore the new error code is set to a number below absolute zero.