HassOSArgonOneAddon
HassOSArgonOneAddon copied to clipboard
It is ignoring floating values
trafficstars
https://github.com/adamoutler/HassOSArgonOneAddon/blob/64e912c1b11ce0075e56f6ba3911bdc819dbf26d/argonOneLinear/run.sh#L141-L157
In my case, I tried:
tmini = 0
tmaxi = 60
CorF = C
cpuRawTemp = 56900
| Line | Variable | Formula | Actual | Expected |
|---|---|---|---|---|
| 141 | value_a | 100/(tmaxi-tmini) | 1 | 1.667 |
| 142 | value_b | -value_a*tmini | 0 | 0 |
| 146 | cpuTemp | cpuRawTemp/1000 | 56 | 56.900 |
| 154 | value | cpuTemp | 56 | 56.900 |
| 157 | fanPercent | value_a*value+value_b | 56 | 94.852 |
We will need to multiply the values by 100, perform the operations then divide by 100. I don't have time to do this now.
@mxr can you handle this? It's related to the way bash handles fp. It's truncated at the point.
I don't use this addon anymore (no longer using this hardware). Not sure if bc is available but you could also try something like
value_a=$(bc <<< "scale=3; 100 / ($tmaxi - $tmini)")
value_b=$(bc <<< "scale=3; -$value_a*$tmini")