Added Total Power Usage

This commit is contained in:
Yordan Suarez
2020-07-04 19:51:20 -04:00
parent b9d87cb14d
commit ed1e7160e3

View File

@@ -205,6 +205,8 @@ class FplApi(object):
r = (await response.json())["data"]
dailyUsage = []
totalPowerUsage = 0
for daily in r["DailyUsage"]["data"]:
if "kwhUsed" in daily.keys():
dailyUsage.append(
@@ -215,8 +217,9 @@ class FplApi(object):
"max_temperature": daily["averageHighTemperature"],
}
)
totalPowerUsage += int(daily["kwhUsed"])
return {"daily_usage": dailyUsage}
return {"total_power_usage": totalPowerUsage, "daily_usage": dailyUsage}
return []