mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-22 17:36:15 +00:00
fix elec price error
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user