sermatec-opensource / sermatec-inverter Goto Github PK
View Code? Open in Web Editor NEWLAN communication docs and scripts for the Sermatec solar inverter.
License: MIT License
LAN communication docs and scripts for the Sermatec solar inverter.
License: MIT License
The protocol parser should work even without data to generate list of supported sensors/actions. This is required by sermatec-opensource/homeassistant-sermatec-inverter#38
For now, I will edit the protocol.json and add custom keys indicating that the field is parsable. However, better idea may be to identify these fields using names, which should be unique?
If the inverter is powered off, the 0C
command response is shorter, this needs to be investigated.
This name should be extracted from CSV files mentioned in #42
Hi,
Trying to send a request when not connected should raise an exception.
There is no difference between bad checksum
and not connected
behavior.
The function should also calculate message length correctly.
The goal is to be compatible with home assistant, also it is a good idea to use SI units wherever applicable
Everything about reverse-engineering and protocol
Use argparse
module.
Now, as the multi-language functionality is implemented, more translations can be created. If you are interesting in creating translation for any language, refer to the CONTRIBUTING.md
file in the repo's root.
Because we know have a self-supporting protocol.json
, we are able to generate a Markdown documentation automatically.
We can use this lib.
0x98
: System Information0x0A
: Battery status0x0B
: Grid and PV status0x0C
: Running status0x95
: Working parameters0x0D
: Load and BMS status0x64
: Set inverter state (on/off)0x66
: Set operating modesThere is now a possibility to use an Android emulator (thus eliminating the need of a compatible rooted Android device). The only requirement is that the inverter's server is reachable at 10.10.100.254
, which is the only address the official app can use (it cannot be changed). There are many ways to achieve that, the obvious one is the direct connection to the inverter in the AP mode, which is not always possible (inverter too far from the development machine running the Android emulator etc.). The way I use is bridging the inverter's network to the main network; for that you will need a router/AP/other network device which supports switching the wlan card to the station mode.
This method shall be documented in the near future, when I have enough time to do so.
Details: use unittest
and maybe tox
.
If the script output is set to human-readable, the json data should be formatted accordingly
Note: It is required to shut off the circuit breaker to force the inverter to run in a backup mode.
Before this issue is resolved, we cannot reliably send parameter changes to the inverter.
Clean old code (used when no protocol JSON was available)
Received data should be checked by the __sendCommandAndReceiveData
, not by parsing functions (getBatteryInfo
etc.).
Hello,
A few days ago I used tcpdump and noticed that the inverter tries every second to connect to the client's IP on tcp/port 18899.
My assumption is that for debugging purposes, the developers "simulate" the server on their local connection and that this connection attempt exists for all connected IPs.
Does anyone have a tcpdump file with actual data they could send me? I do not have a connection with a European or Chinese serer on my inverter.
Another question, does anyone have firmware files or could tell me where I can find them? I have a old one "PCU5KSL_412.bin".
THANKS.
e.g. the how_many_sets_of_data_are_there
As for now, addresses in the request/response docs are indexed from the start of the data (including the header). Now when the structure of the protocol is known and it is always same for every request and response, we can start documenting only the request/response payload, thus eliminating redundancy.
For the preliminary support, ability to configure these will suffice:
The script should check if the inverter is compatible (version in 0x98
), if not, decline (add bypass possibility with some flag --disable-checks).
There is now a possibility to use an Android emulator (thus eliminating the need of a compatible rooted Android device). The only requirement is that the inverter's server is reachable at 10.10.100.254
, which is the only address the official app can use (it cannot be changed). There are many ways to achieve that, the obvious one being the direct connection to the inverter in the AP mode, which is not always possible (inverter too far from the development machine running the Android emulator etc.). The way I use is bridging the inverter's network to the main network; for that you will need a router/AP/other network device which supports switching the wlan card to the station mode.
This method shall be documented in the near future, when I have enough time to do so.
Oh yeah, good ol Sermatec and their horrible naming. Need to find the correct sensor.
Suppress all message except output (to make output easy to integrate with other scripts)
There should be a separate CSV for every language in this format: "key";"translation". This will be handy for usage with Home Assistant.
Example:
en.csv
"grid_voltage_frequency";"Grid Frequency"
cs.csv
"grid_voltage_frequency";"Frekvence sรญtฤ"
Hi,
I think that taking advantage of docker in order to run the script in a fully under control environment, instead of running directly from your computer python install, that could be different from a computer to another.
It could avoid the "it works on my computer" effect.
I know pretty well docker, that's why I suggest this, but I know that python have is own system venv
but I'm not confident with it...
What do you think about it ?
File "/home/golas/Repos/sermatec-inverter/src/sermatec_inverter/protocol_parser.py", line 239, in parseReply
newField["value"] = int(binString[fieldBitPosition])
~~~~~~~~~^^^^^^^^^^^^^^^^^^
IndexError: string index out of range
For now the language can be only selected by directly using Sermatec class, not via built-in cmdline interface. New optional param like --lang
should be added. Supported options can be enumerated by listing csv file names in translations folder.
Hello alls,
I think my work about a full CLI and MQTT proxy using protocol.json
is near production ready. Is someone want to test?
I was happy to be able to contribute.
If you want to add my MIT code to "sermatec-opensource", you can.
Have a nice day.
This will be handy for usage with homeassistant integration
sth like (Path(__file__).parent / "protocol-en.json").absolute()
This new class will be able to load all the information from the protocol.json
.
We can get the inverter's software version (command 98
, which is available on every inverter's SW version) and then decide which commands will be available in the script for the particular version. There are version
keys in the recent protocol.json
files, so I suppose they were added for a backward compatibility with non-updated inverters.
This can probably be a separate PyPI module to provide an independent parsing library. not now
Expected features:
e.g. battery names, same treatment as with sensor names --> lookup in csv
A file describing whole protocol was found - it can't be published in its original form but it will probably help to implement the rest of the protocol without a need of a packet sniffing.
This script should preprocess the protocol.json
as described in this comment. The main goal is to create a self-supporting all-containing file that will be used to generate docs and available commands in the communication script.
The main things to be processed/added are:
grid_frequency
, battery_max_charging_current
, ...)%
in the battery SOC and SOHAll stuff should be pulled from the CSV or similar file as it is here.
I essentially target at expanding a functionality of the existing bash script. Because it will be needed only in preprocessing, it can remain coded in bash or we can create a Python script.
@sbechet If you are interested in expanding your script, it would be wonderful! ๐. Otherwise I'll look into it myself.
Now we can calculate the checksum, instead copying it from the protocol. This means we will be soon able to send configuration command 0x66
.
Low priority, not needed for now
As a response to 95 query, the inverter actually returns two packets containing 95 and 9D. __sendQuery
function will have to be fixed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.