From 56c66a19f0ae41173295851cc434691b0ea64127 Mon Sep 17 00:00:00 2001 From: dominikandreas Date: Thu, 2 Nov 2017 09:17:26 +0100 Subject: [PATCH] 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. --- homeassistant/components/plant.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/plant.py b/homeassistant/components/plant.py index 3a6876e3e12..523fa2d6859 100644 --- a/homeassistant/components/plant.py +++ b/homeassistant/components/plant.py @@ -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)