mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Update plant for dealing with float values (#10246)
Value parsing in plant component throws an ValueError if values are given as floats. This commit changes int(value) to int(float(value)) to avoid this error.
This commit is contained in:
parent
79da44a6b3
commit
56c66a19f0
@ -171,15 +171,15 @@ class Plant(Entity):
|
|||||||
|
|
||||||
reading = self._sensormap[entity_id]
|
reading = self._sensormap[entity_id]
|
||||||
if reading == READING_MOISTURE:
|
if reading == READING_MOISTURE:
|
||||||
self._moisture = int(value)
|
self._moisture = int(float(value))
|
||||||
elif reading == READING_BATTERY:
|
elif reading == READING_BATTERY:
|
||||||
self._battery = int(value)
|
self._battery = int(float(value))
|
||||||
elif reading == READING_TEMPERATURE:
|
elif reading == READING_TEMPERATURE:
|
||||||
self._temperature = float(value)
|
self._temperature = float(value)
|
||||||
elif reading == READING_CONDUCTIVITY:
|
elif reading == READING_CONDUCTIVITY:
|
||||||
self._conductivity = int(value)
|
self._conductivity = int(float(value))
|
||||||
elif reading == READING_BRIGHTNESS:
|
elif reading == READING_BRIGHTNESS:
|
||||||
self._brightness = int(value)
|
self._brightness = int(float(value))
|
||||||
else:
|
else:
|
||||||
raise _LOGGER.error("Unknown reading from sensor %s: %s",
|
raise _LOGGER.error("Unknown reading from sensor %s: %s",
|
||||||
entity_id, value)
|
entity_id, value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user