Improve string formatting v2 (#33645)

* Improve string formatting v2

* Improve string formatting v3

* Address review comments
This commit is contained in:
springstan authored and GitHub committed 2020-04-04 23:09:34 +02:00
1 parent d2e70eb967
commit dde93304d3
28 files changed
+42 -40

No files matched your search

+1 -1
View File
@@ -246,7 +246,7 @@ class ModbusRegisterSensor(RestoreEntity):
if isinstance(val, int):
self._value = str(val)
if self._precision > 0:
self._value += "." + "0" * self._precision
self._value += f".{'0' * self._precision}"
else:
self._value = f"{val:.{self._precision}f}"