read_regs working, design notes added
This commit is contained in:
parent
2e73243082
commit
622b88c81c
2 changed files with 79 additions and 0 deletions
47
DesignNotes.md
Normal file
47
DesignNotes.md
Normal file
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
32
read_regs.py
Executable file
32
read_regs.py
Executable file
|
@ -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)
|
Loading…
Reference in a new issue