Code Monkey home page Code Monkey logo

sermatec-inverter's Issues

Add parsing for fields with known meanings

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?

  • Battery state
  • Working mode
  • Battery communication status
  • Anti-backflow
  • Grid codes
  • DC side battery types
  • Battery protocol
  • Meter protocol
  • Model code
  • Battery manufacturer
  • Battery error

Fix units in protocol json

The goal is to be compatible with home assistant, also it is a good idea to use SI units wherever applicable

Add more translations

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.

Tracking of supported and planned commands

Query

  • 0x98: System Information
  • 0x0A: Battery status
  • 0x0B: Grid and PV status
  • 0x0C: Running status
  • 0x95: Working parameters
  • 0x0D: Load and BMS status

Setting

  • 0x64: Set inverter state (on/off)
  • 0x66: Set operating modes

Document a development using AVD

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 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.

Add tests

  • implement a mock server to allow automatic testing,
  • implement some integration tests to test against real inverter.

Details: use unittest and maybe tox.

Cleanup

Clean old code (used when no protocol JSON was available)

Like a server?

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.

Unify addressing in protocol docs - start from zero

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.

Add parameter configuration functions

For the preliminary support, ability to configure these will suffice:

  • Power on/off
  • lower battery SOC limit
  • Operating mode
  • Anti-backflow function on/off

Document a development using AVD

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.

Add silent/quiet mode

Suppress all message except output (to make output easy to integrate with other scripts)

Add sensor names translations

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ฤ›"

Use a docker container to run the script in dev purpose

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 ?

Fix error when received data is too small

  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

Add language param to cmdline interface

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.

sermatec-ess

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.

Create protocol.json parser

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:

  • if no tag is provided in the protocol, we should create the tag from the name,
  • load error code from relevant files and replace the codes with strings

Process protocol.json

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.

  • Translate from Chinese
  • Verify the information in the file
  • Rewrite the information from the file to the documentation
  • (future issues) Implement

Create protocol.json preprocessor

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:

  • translation of the comments
  • tags
    • they should be unique, so we can use them e.g. in Home Assistant integration,
    • they should also follow the current snake_case format (grid_frequency, battery_max_charging_current, ...)
  • units - e.g. there should be % in the battery SOC and SOH

All 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.

Add checksum calculation

Now we can calculate the checksum, instead copying it from the protocol. This means we will be soon able to send configuration command 0x66.

Fix 95, 9D commands

As a response to 95 query, the inverter actually returns two packets containing 95 and 9D. __sendQuery function will have to be fixed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.