diff --git a/DesignNotes.md b/DesignNotes.md new file mode 100644 index 0000000..b74bd22 --- /dev/null +++ b/DesignNotes.md @@ -0,0 +1,47 @@ +# Purpose + +I want to be able to charge my battery system sufficiently to never have to pull from the grid during peak charge times. + + +# Design Goals + +Provide a machanism where I can set the system to charge from the grid +Provide a mechanism for seeing the current charge values +Provide a mechanims for turning off charging from the grid + +# Eventual goals + +Provide a mechanism to look at current SoC, discharge rate and current time, determine if we'll be below a given %SoC by the given Peak time, set to charge from grid if we'll be below that, turn off at given peak time. (Is this better suited to system level bash script?) +Home Assistant integration +Adjust SBAM code to do same. + +# Non Goals + +None as yet + +# Objects + +SimpleStorageControl + Constructor: + requires: modbus client object + optional: + + method: ChargeFromGrid + params: Optional kW to charge at, default: MaxChargePower + returns: None + + method: StopChargeFromGrid + params: None + returns: None + + method: getStateOfCharge + params: None + returns: Integer, percent + + method: getMaxChargePower + params: None + returns: Integer, Watts + + + + diff --git a/read_regs.py b/read_regs.py new file mode 100755 index 0000000..bfd58f1 --- /dev/null +++ b/read_regs.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +from froniusreg import froniusreg + +from pymodbus.client.tcp import ModbusTcpClient + +fronius1 = ModbusTcpClient("172.19.107.211", port=502, timeout=10) +fronius1.connect() + +soc = froniusreg.scaledStateOfCharge.getValue(fronius1) +print(" SOC: %s%%" % soc) + +discharge = froniusreg.scaledOutWRte.getValue(fronius1) +print("Pre DRate: %d%%" % discharge) + +charge = froniusreg.scaledInWRte.getValue(fronius1) +print("Pre CRate: %d%%" % charge) + +mode = froniusreg.StorCtl_Mode.getValue(fronius1) +print("Pre Mode: %d" % mode) + +reserve = froniusreg.scaledReserve.getValue(fronius1) +print("Pre Res: %d" % reserve) + +rate = froniusreg.scaledMaxChaRte.getValue(fronius1) +print("Pre rate: %d" % rate) + +rate = froniusreg.scaledMaxWChaGra.getValue(fronius1) +print("Pre WGra rate: %d" % rate) + +revert = froniusreg.InOutWRte_RvrtTms.getValue(fronius1) +print("Timer: %d" % revert)