Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FYI: Omnik looks like Goodwe #3

Open
micolous opened this issue Oct 5, 2020 · 2 comments
Open

FYI: Omnik looks like Goodwe #3

micolous opened this issue Oct 5, 2020 · 2 comments

Comments

@micolous
Copy link

micolous commented Oct 5, 2020

FYI: I've been poking at a friend's GoodWe WiFi module, and it seems to have some similar behaviour to this Omnik module.

There are some publicly accessible protocol docs for the RS485 side, which look a little bit like what you've implemented in InverterMsg.py.

Unfortunately, the GoodWe unit (like this Omnik one) seems to lack the webdata_sn etc. variables at http://10.10.100.253/status_en.html which make it a little harder to scrape.

Also: it should be possible to simplify this software if you have something listening for the connection that the WiFi module tries to make, rather than needing to use iptables rules to tee the traffic and actually connect this module to the internet. There's some pretty serious problems with the module which make me definitely not want to give it actual internet access (eg: it only requires HTTP authentication once per boot, but then lets anything connect to it once "unlocked", and the HTTP server implementation is generally pretty fragile and I've had it crash or send bad responses on me using curl).

I noticed the stuff built around the GoodWe system for Home Assistant seems to be built around scraping from the manufacturer's web service, rather than running everything locally.

@wouterbaake
Copy link
Owner

Yeah, that seems like a similar data structure.
The Omnik Wifi modules differ in the way they operate across different versions. The version 601 (that I am stuck with) seems to connect to a specific IP address and then send a TCP packet with the data in it. Nothing more. No API to get any data from.

I've tried to make a client that listens to the Omnik and accepts the TCP packet, but that requires some SNAT and DNAT that I haven't gotten working yet...

@micolous
Copy link
Author

micolous commented Oct 6, 2020

Ah, that's a pain. Here I was presuming they'd use DNS or something that you can hijack a little easier. 😉

What may be cleaner is using TPROXY. In your Python code, do something like:

socket.setsockopt(socket.SOL_IP, socket.IP_TRANSPARENT, mark)

I wrote something ages ago to do this; since then Python added support for IP_TRANSPARENT it should be a little easier.

There's nothing about TPROXY or IP_TRANSPARENT that forces you to use HTTP – any TCP service should work with it.

Unfortunately, the script will probably still need CAP_NET_ADMIN to work. But at least it takes the manufacturer's servers out of the loop, and can run locally. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants