mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
* fix derived rate, fixes #20097 * fix derived rate, fixes #20097 * Fix typo thnx @amelchio * Make the test more realistic Took values from my own smart meter for the test * Update test to ignore rounding issues
This commit is contained in:
committed by
Anders Melchiorsen
parent
818776d2b4
commit
2017e45d78
@@ -350,7 +350,8 @@ class DerivativeDSMREntity(DSMREntity):
|
||||
else:
|
||||
# Recalculate the rate
|
||||
diff = current_reading - self._previous_reading
|
||||
self._state = diff
|
||||
timediff = timestamp - self._previous_timestamp
|
||||
self._state = diff / timediff * 3600
|
||||
|
||||
self._previous_reading = current_reading
|
||||
self._previous_timestamp = timestamp
|
||||
|
||||
Reference in New Issue
Block a user