Fix broken upnp derived sensors reporting b/s instead of kb/s (#57681)
This commit is contained in:
parent
12d1dfdaf9
commit
b75f1b8951
7 changed files with 191 additions and 10 deletions
|
@ -190,7 +190,10 @@ class DerivedUpnpSensor(UpnpSensor):
|
|||
|
||||
# Calculate derivative.
|
||||
delta_value = current_value - self._last_value
|
||||
if self.entity_description.native_unit_of_measurement == DATA_BYTES:
|
||||
if (
|
||||
self.entity_description.native_unit_of_measurement
|
||||
== DATA_RATE_KIBIBYTES_PER_SECOND
|
||||
):
|
||||
delta_value /= KIBIBYTE
|
||||
delta_time = current_timestamp - self._last_timestamp
|
||||
if delta_time.total_seconds() == 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue