Skip to content

Auto loading KIWATT inverter 10,0kW with ANWB Energie Dynamic Contract | lowest prices ENTSO-e (API)

Notifications You must be signed in to change notification settings

RPJacobs/Kiwatt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kiwatt

Settings of inverter video: https://www.youtube.com/watch?v=miOrLBp4t0Q

Auto loading KIWATT inverter 10,0kW with ANWB Energie Dynamic Contract | lowest prices ENTSO-e (API) | forcast.solar to forcast production today

I've installed a Kiwatt inverter and two 10kWh batteries:

Screenshot 2023-02-23 at 09 18 32

ANWB Dynamic Energy Contract, hourly prices.

Goal is to set this load table in the inverter

Screenshot 2023-02-23 at 09 18 44

Let's start with a dongle connected to the inverter

Screenshot 2023-02-23 at 09 22 43

It's a 'stick logger', my best friend google told me it is a SOFAR, SOLARMAN LS4G-3. Here is a manual (in dutch) found the default user and password (admin/admin)

https://www.woud-energieadvies.nl/wp-content/uploads/2020/03/Wi-Fi-installatie-Sofar-Solar.pdf

After connecting the logger to my local network it aumatically connected to a remote server. It connects to https://pro.solarmanpv.com/ you can create an account and based on the serial nummer of the logger (security issue!!) you can read al kinds of data. Inverter Type:Three phase LV Hybrid! This learned me that my inverter is also sold as Deye and Sunsynk. Interesting; goal number 2, block external connection. Google a bit more and I found the config page. http://x.x.x.x/config_hide.html here you can remove or change the remote server settings.

After a quick portscan: 8899. A modbus interface, found a library: https://github.com/jmccrohan/pysolarmanv5 with great documentation!

Now we need to find the modbus documentation of our inverter. Scanning the registry with pysolarmanv5 showed me the registers 0-900 and 10000-20000 are used. Also discoverd the SOC (battery percentage) as register 588. Eventually i used https://github.com/StephanJoubert/home_assistant_solarman to read all values to a home assistent setup. Reading is fine but i needed to write the registers! Used the config file form StephanJoubert: deye_sg04lp3.yaml and a lot of googling later a found a word doc in a forum with the documentation.

Modbus amit posun.docx

Screenshot 2023-02-23 at 09 53 16

With the registers I needed:

Screenshot 2023-02-23 at 09 54 34

pysolarmanv5 test code:

""" Scan Modbus registers to find valid registers"""
from pysolarmanv5 import PySolarmanV5
import requests

def main():
    modbus = PySolarmanV5(
        "x.x.x.x", 2713xxxxxx, port=8899, mb_slave_id=1, verbose=0
    )
    """Times"""
    print(modbus.read_holding_registers(register_addr=148, quantity=6))
    """Percentage"""
    print(modbus.read_holding_registers(register_addr=166, quantity=6))
    """Enable grid charge"""
    print(modbus.read_holding_registers(register_addr=172, quantity=6))
    
    """set time 1"""
    modbus.write_multiple_holding_registers(register_addr=148, values=[100, 300, 900, 1300, 1800, 2100])

    """Times"""
    print(modbus.read_holding_registers(register_addr=148, quantity=6))
    
if __name__ == "__main__":
    main()

Now all I needed was an API with the price forcast.

https://doe-duurzaam.nl/2023/01/02/dynamische-energieprijzen-inlezen-met-home-assistant-zo-doe-je-dat/ Helped me to find ENTSO-e.

And ofcourse there is a library: https://github.com/EnergieID/entsoe-py

My script can now:

  1. Download an XML with day_ahead_prices.
  2. find the lowest prices (3 hours to load all 20kWh)
  3. programm the inverter to load from grid.

update 10 April 2023

Added PV functions

  1. calculate battery load based on forcast.solar forcast production today
  2. check if battery needs to load before first cheapest loadpoint, find cheapest point before battery is empty

Installation

pip install pysolarmanv5

pip install entsoe-py

pip install beautifulsoup4

copy config copy.json to config.json (set your data)

My File

Used a cronjob to load the script @xx:59 and telegram to send me an update...

About

Auto loading KIWATT inverter 10,0kW with ANWB Energie Dynamic Contract | lowest prices ENTSO-e (API)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages