HassOSArgonOneAddon icon indicating copy to clipboard operation
HassOSArgonOneAddon copied to clipboard

It is ignoring floating values

Open w35l3y opened this issue 1 year ago • 3 comments
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

w35l3y avatar Sep 09 '24 22:09 w35l3y

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.

adamoutler avatar Sep 09 '24 22:09 adamoutler

@mxr can you handle this? It's related to the way bash handles fp. It's truncated at the point.

adamoutler avatar Sep 09 '24 22:09 adamoutler

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")

mxr avatar Sep 10 '24 00:09 mxr