Fix rate of change calculation of statistics sensor (#32597)
* Fix rate of change of statistics sensor * Fix test
This commit is contained in:
1 parent
440c837eb6
commit
5216dc0ae1
2 files changed
+2
-2
No files matched your search
@@ -267,7 +267,7 @@ class StatisticsSensor(Entity):
|
||||
|
||||
time_diff = (self.max_age - self.min_age).total_seconds()
|
||||
if time_diff > 0:
|
||||
self.change_rate = self.average_change / time_diff
|
||||
self.change_rate = self.change / time_diff
|
||||
|
||||
self.change = round(self.change, self._precision)
|
||||
self.average_change = round(self.average_change, self._precision)
|
||||
|
||||
Reference in new issue
Block a user