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.pull/10285/merge
parent
79da44a6b3
commit
56c66a19f0
homeassistant/components
|
@ -171,15 +171,15 @@ class Plant(Entity):
|
|||
|
||||
reading = self._sensormap[entity_id]
|
||||
if reading == READING_MOISTURE:
|
||||
self._moisture = int(value)
|
||||
self._moisture = int(float(value))
|
||||
elif reading == READING_BATTERY:
|
||||
self._battery = int(value)
|
||||
self._battery = int(float(value))
|
||||
elif reading == READING_TEMPERATURE:
|
||||
self._temperature = float(value)
|
||||
elif reading == READING_CONDUCTIVITY:
|
||||
self._conductivity = int(value)
|
||||
self._conductivity = int(float(value))
|
||||
elif reading == READING_BRIGHTNESS:
|
||||
self._brightness = int(value)
|
||||
self._brightness = int(float(value))
|
||||
else:
|
||||
raise _LOGGER.error("Unknown reading from sensor %s: %s",
|
||||
entity_id, value)
|
||||
|
|
Loading…
Reference in New Issue