AC Battery Status

Example Pythion Script to read Battery Information

import requests
import json

def jsonprint(object):
# create a formatted string of the Python JSON object
text = json.dumps(object, sort_keys=True, indent=4)
print(text)

# Example Plantnumber  =- “L123456”

# response = requests.post(“https://www.givenergy.cloud/GivManage/api/login?account=<your plant number>&password=<your password>”)
# print(response.status_code)
# jsonprint(response.json())

s = requests.Session()
data = {“account”:”<your plant number>”,”password”:”<your password>”}
url = “https://www.givenergy.cloud/GivManage/api/login”
r = s.post(url, data=data)
print(r)

url = “https://www.givenergy.cloud/GivManage/api/plant/getPlantSummary”

data = {“”}
r = s.post(url, data=data)
jsonprint(r.json())

#chargeToday = r.json()[‘chargeEnergyToday’]
#capacityToday = float(r.json()[‘btToday’])
#capacityNow = float(r.json()[‘chargeEnergyToday’])
#capacityUsed = float(capacityToday – capacityNow)
#currentLoadPower = r.json()[‘batPower’]
#supplyVoltage = r.json()[‘voltageText’]
#stateOfCharge = r.json()[‘soc’]
#energyToday = r.json()[‘energyTodayText’]

#print(” Energy today = “, energyToday)
#print(” Charge today = “, chargeToday)
#print(” Charged today = “, float(r.json()[‘btToday’]))
#print(” Current capacity = “, float(r.json()[‘chargeEnergyToday’]))
#print(” Used capacity = “, “%.2f” %float(capacityToday – capacityNow))
#print(“Current Load Power = “, currentLoadPower)
#print(” Battery SoC = “, stateOfCharge, “%”)
#print(” Supply Voltage = “, supplyVoltage)

#s = requests.Session()
#data = {“account”:”<your plant number>”,”password”:”<your password>”}
#url = “https://www.givenergy.cloud/GivManage/api/login”
#r = s.post(url, data=data)
#print(r)

# ####################################### Example response
#{
# “activeInverterCount”: “1/1”,
# “averageHomeSelfConsumptionToday”: 0,
# “averageHomeSelfConsumptionTotal”: “96.05”,
# “batPower”: “-1.28”,
# “batteryCapacity”: 8.0,
# “batteryCapacityText”: “8.00 kWh”,
# “btMonth”: “22.10”,
# “btToday”: “6.70”,
# “bttTotal”: “403.20”,
# “bttTotalText”: “403.20 kWh”,
# “chargeEnergyToday”: “6.70”,
# “consumptionEnergyToday”: “4.60”,
# “consumptionEnergyTodayText”: “4.60 kWh”,
# “consumptionEnergyTotal”: “1298.50”,
# “consumptionEnergyTotalText”: “1298.50 kWh”,
# “currentText”: “4.40 A”,
# “dailyAlarmCount”: 0,
# “dischargeEnergyToday”: “0.00”,
# “energyToday”: “9.20”,
# “energyTodayText”: “9.20 kWh”,
# “exportEnergyToday”: “0.10”,
# “exportEnergyTodayText”: “0.10 kWh”,
# “exportEnergyTotal”: “19.60”,
# “exportEnergyTotalText”: “19.60 kWh”,
# “feedInTariffToday”: “–“,
# “feedInTariffTotal”: “–“,
# “frequencyText”: “49.87 Hz”,
# “gridEnergyOutToday”: “–“,
# “gridEnergyOutTotal”: “–“,
# “gridPower”: “-124.00”,
# “gridPowerkW”: “-0.12”,
# “gridRelianceToday”: 47,
# “gridRelianceTotal”: 66,
# “hasMeterInfo”: true,
# “importEnergyToday”: “2.20”,
# “importEnergyTodayText”: “2.20 kWh”,
# “importEnergyTotal”: “862.50”,
# “importEnergyTotalText”: “862.50 kWh”,
# “loadPower”: 434,
# “loadPowerText”: “434 W”,
# “loadPowerkW”: “0.43”,
# “monthCo2Saved”: “0.006”,
# “pInv”: -1289,
# “pvPower”: “1599.00”,
# “pvPowerText”: “1.60 kW”,
# “pvPowerkW”: “1.60”,
# “savingsToday”: “–“,
# “savingsTotal”: “–“,
# “selfConsumptionToday”: “9.10”,
# “selfConsumptionTodayText”: “9.10 kWh”,
# “selfConsumptionTotal”: “476.70”,
# “selfConsumptionTotalText”: “476.70 kWh”,
# “soc”: 97,
# “success”: true,
# “todayCo2Saved”: “0.000”,
# “totalCo2Saved”: “0.495”,
# “totalGeneration”: “496.30”,
# “totalGenerationText”: “496.30 kWh”,
# “voltageText”: “242.20 V”
#}