fix elec price error

This commit is contained in:
jlayec
2021-05-03 20:09:09 +02:00
committed by Florian BEZANNIER
parent 19446f16a5
commit 6ac1377e0c
+2 -2
View File
@@ -1,6 +1,6 @@
from datetime import datetime, timezone, timedelta
import configparser
from statistics import mean
from statistics import mean, StatisticsError
from mylogger import logger
@@ -61,7 +61,7 @@ class ElecPrice:
date = date + timedelta(minutes=30)
try:
res = round(consumption * mean(prices), 2)
except TypeError:
except (TypeError, StatisticsError):
logger.error("Can't get_price of charge, check config")
return res