Page 1 of 1

Precision of values

PostPosted: Sat Jun 11, 2016 12:01 pm
by Nine
If I set the precision of some values in the config to 0:
Bildschirmfoto 2016-06-11 um 19.54.09.png
Bildschirmfoto 2016-06-11 um 19.54.09.png (97.26 KiB) Viewed 1688 times


the WUnderground-Device shows everything correctly:
Bildschirmfoto 2016-06-11 um 19.54.22.png
Bildschirmfoto 2016-06-11 um 19.54.22.png (25.01 KiB) Viewed 1688 times


But if I then write out the value of eg the max temp to a variable, there is a decimal place:
Bildschirmfoto 2016-06-11 um 19.54.31.png
Bildschirmfoto 2016-06-11 um 19.54.31.png (8.38 KiB) Viewed 1688 times


Is that a bug or make I a mistake?

Nine

Re: Precision of values

PostPosted: Sat Jun 11, 2016 12:54 pm
by DaveL17
Is that a bug or make I a mistake?

Neither. Indigo has the capacity to maintain two values for each device state--(1) the actual state value, and (2) one to display in Indigo's UI. When you change the decimal precision value in the plugin, you're affecting only the UI value (the actual value remains unchanged.) This is purposeful behavior.

How are you writing out the value to the variable? If you're using Python, it's an easy fix.
Code: Select all
x = indigo.devices[1258163860].states["foreHigh1"]
y = indigo.devices[1258163860].states["foreHigh1.ui"]

indigo.server.log(unicode(x))
indigo.server.log(unicode(y))


Which yields this:
Code: Select all
Jun 11, 2016, 1:53:22 PM
  Script                          93.0
  Script                          93°

Re: Precision of values

PostPosted: Sun Jun 12, 2016 3:28 am
by Nine
Thx for your explanations Dave. I can not use "foreHigh1.ui" because the TTS for german does not speak the degree-sign correctly (it says "degree-sign" instead of "degree")... so I will have to convert the "foreHigh1" to a number without decimal place...

Nine

Re: Precision of values

PostPosted: Sun Jun 12, 2016 5:17 am
by DaveL17
That sounds like the best approach to me, too. Good luck!


Sent from my iPhone using Tapatalk