mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Allow decimal numbers (Thanks @luxus)
This commit is contained in:
parent
7da104af4e
commit
a32229b4ce
@ -108,12 +108,15 @@ class CommandSensor(Entity):
|
||||
self.data.update()
|
||||
value = self.data.value
|
||||
|
||||
try:
|
||||
if value is not None:
|
||||
if self._corr_factor is not None:
|
||||
self._state = round((int(value) * self._corr_factor),
|
||||
self._state = round((float(value) * self._corr_factor),
|
||||
self._decimal_places)
|
||||
else:
|
||||
self._state = value
|
||||
except ValueError:
|
||||
self._state = value
|
||||
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
|
Loading…
x
Reference in New Issue
Block a user