-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtestreq.py
35 lines (30 loc) · 1.14 KB
/
testreq.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from src.kostalplenticore import EnergyUnit, connect as kostalplenticoreconnect
import json
from tabulate import tabulate
# Opening JSON config file
confFile = open('config.json',)
# returns JSON object as
# a dictionary
config = json.load(confFile)
# Connect
con = kostalplenticoreconnect(config['host'], config['password'])
con.login()
# Create table
table = [
# Battery
["Battery SoC",con.getBatteryPercent(),"%"],
["Battery cycles",con.getBatteryCycles(),""],
# Power
["Home Power",con.getHomePowerConsumption(),"W"],
["PV Power",con.getPvPower(),"W"],
["Grid Power",con.getGridPower(),"W"],
["Battery Power",con.getBatteryPower(),"W"],
# Energy
["Home energy usage",con.getHomeConsumptionTotal(),"kWh"],
["Home energy usage from grid",con.getHomeConsumptionFromGridTotal(),"kWh"],
["Home energy usage from PV",con.getHomeConsumptionFromPVTotal(),"kWh"],
["Home energy usage from battery",con.getHomeConsumptionFromBatTotal(EnergyUnit.Wh),"Wh"],
# Voltage
["Voltage 3P average",con.getAcVoltage3pAvg(),"V"]
]
print(tabulate(table))