From 9e59d5254b894ce61b71eb892791c8f2d8ba45ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 27 Dec 2020 20:30:12 +0000 Subject: [PATCH] Fix rate_of_change function. --- neohubapi/neohub.py | 2 +- neohubapi/neostat.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/neohubapi/neohub.py b/neohubapi/neohub.py index dfd8a8b..8bb081c 100644 --- a/neohubapi/neohub.py +++ b/neohubapi/neohub.py @@ -449,4 +449,4 @@ class NeoHub: message = {"VIEW_ROC": names} result = await self._send(message) - return result + return result.__dict__ diff --git a/neohubapi/neostat.py b/neohubapi/neostat.py index d5983bb..27a0281 100644 --- a/neohubapi/neostat.py +++ b/neohubapi/neostat.py @@ -4,9 +4,10 @@ # SPDX-License-Identifier: LGPL-3.0-or-later from datetime import datetime, timedelta - from types import SimpleNamespace +from async_property import async_property + from neohubapi.enums import Weekday @@ -122,6 +123,8 @@ class NeoStat(SimpleNamespace): result = await self._hub.set_diff(switching_differential, [self]) return result + @async_property async def rate_of_change(self): result = await self._hub.rate_of_change([self]) - return result + roc = result[self.name] + return roc