Fix lifespans being reported much lower than reality

Original implementation assumed that the "total" value from the API response was the denominator for lifespan, but this was incorrect. The "val" from the `life_span` message is the percentage represented as a whole number, with no dividing necessary.
This commit is contained in:
Greg Laabs
2018-07-29 15:22:31 -07:00
parent 73c906bc6e
commit 276721e280
2 changed files with 6 additions and 6 deletions
+1 -3
View File
@@ -296,9 +296,7 @@ class VacBot():
except KeyError:
_LOGGER.warning("Unknown component type: '" + type + "'")
total = float(event['total'])
val = float(event['val'])
lifespan = val / total
lifespan = int(event['val']) / 100
self.components[type] = lifespan
lifespan_event = {'type': type, 'lifespan': lifespan}