1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-06 05:12:21 +01:00

Update the delta filter to take a percentage value as well as an absolute value (#4391)

This commit is contained in:
Trent Houliston
2023-03-16 09:20:18 +11:00
committed by GitHub
parent 1b8b8cdd11
commit 25fb288016
5 changed files with 29 additions and 10 deletions

View File

@@ -1097,7 +1097,7 @@ def possibly_negative_percentage(value):
if isinstance(value, str):
try:
if value.endswith("%"):
has_percent_sign = False
has_percent_sign = True
value = float(value[:-1].rstrip()) / 100.0
else:
value = float(value)