Fix rate_of_change function.

This commit is contained in:
Andrius Štikonas 2020-12-27 20:30:12 +00:00
parent 0d5074fd4e
commit 9e59d5254b
2 changed files with 6 additions and 3 deletions

View File

@ -449,4 +449,4 @@ class NeoHub:
message = {"VIEW_ROC": names}
result = await self._send(message)
return result
return result.__dict__

View File

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