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:
dominikandreas 2017-11-02 09:17:26 +01:00 committed by Fabian Affolter
parent 79da44a6b3
commit 56c66a19f0

View File

@ -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)