Page 1 of 1

change format to not have 2.5000000000001 strings in states

PostPosted: Tue Oct 03, 2017 11:07 pm
by kw123
suggestion to the authors or Matt,Jay:

with adding decimalPlaces :
Code: Select all
   def _addToBatchStatesChange(self, dev, key="", value="",decimalPlaces=""):
      devId = dev.id
      if devId not in self.batchStatesUpdate:
         self.batchStatesUpdate[devId] = []
      if decimalPlaces == "":
         self.batchStatesUpdate[devId].append({"key":key, "value":value})
      else:
         self.batchStatesUpdate[devId].append({"key":key, "value":value,"decimalPlaces":decimalPlaces})
      return

and adding decimalplaces to each of the calls with numbers to e.g.:
Code: Select all
         self._addToBatchStatesChange(self.tempList[sensor], key=u"currentMonthTotal", value=currentMonthTotal,decimalPlaces=2)         
It looks much better ===> "2.5000000000001" becomes "2.50"

Karl

Re: change format to not have 2.5000000000001 strings in sta

PostPosted: Tue Oct 03, 2017 11:11 pm
by jay (support)

Re: change format to not have 2.5000000000001 strings in sta

PostPosted: Wed Oct 04, 2017 10:07 am
by kw123
know the GitHub site.
The posted version does not have this option.
And I found no way to post/comment anything.

Thats why I posted it here.

Karl

Re: change format to not have 2.5000000000001 strings in sta

PostPosted: Wed Oct 04, 2017 1:04 pm
by jay (support)
Fork it, change it, and issue a pull request - since it's open source you can do the work yourself, that's the best way to get it done. Alternately, you can add an issue on Github for it and perhaps someone else will do it.