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

Run as standalone client app #180

Open
il-steffen opened this issue Sep 2, 2024 · 4 comments
Open

Run as standalone client app #180

il-steffen opened this issue Sep 2, 2024 · 4 comments

Comments

@il-steffen
Copy link

il-steffen commented Sep 2, 2024

Thanks for your project!

My inverter powered up this morning and thanks to your project I was able to connect + setup wifi without (so far) having to go through TSUN/Orbit app registration stuff.

However I have HA and MQTT and many other things already running and I'm not a fan of "managing" applications with Docker. The new client mode also seems to make many things obsolete - I just need a client to poll the inverter and push the data to my favorite data base. One tool for one job.

I ran into a few issues trying to get this working and listed my detailed steps/problems below. Maybe this will be helpful for others or to improve the app. Also appreciate any comments if something can be done differently.

1. Attempt to install basic python app instead of Docker stuff

  1. python3 -m venv .venv; source .venv/bin/activate; pip -r requirements.txt
  2. app entry point at app/src/server.py, example config in app/config
  3. I got a Module not found tomllib - we seem to require >=python3.11
  4. next we die on logging: logging.config.fileConfig('logging.ini') - need to run from within app/src
  5. failed to open log/proxy.log - need to create log/
  6. failed to open default_config.toml, after copying this from ../config it tries to shutil.copy2() it to config/, then again fails to open and advises about renaming some example.toml. So actually we need to copy to app/src/config/config.toml...
  7. now it starts: cd app/src; python3 server.py

2. Configuration file...I think this could use some background to explain the purpose of each section

  1. reach tsun/solarman cloud....why do we care? just for FW updates?
  2. home assistant config could use 1-2 sentences background info as well. The comments sound like you're actually listening/checking on some HA status updates? Or is this actually just mqtt topics chosen so that they directly popup in HA?
  3. inverter mapping looks reasonable, although its not immediately clear which elements are important and how it relates to client_mode. After putting the inverter IP into client_mode I could see my TSUN MS2000 pop up in HA MQTT, so that's great. The other two default configured inverters didn't show up anywhere and the wrong serial number also didn't seem to matter...
  4. what does modbus_polling do? is this just for specific inverters, do we need special cabling, does it give us extra information or alternative way to access the device instead of wifi/proxy?
  5. pv=...seems to be cosmetic / info strings only. can we disable a pv entry if a panel port is unused?
  6. acl....these are more clear after seeing the wiki reference info. it seems more like a low-level / expert config setting. I guess it is not relevant for client_mode or when the tsun/solarman cloud connection is not enabled?

Need to play around some more...to be continued..

Edit: More reference info in the project wiki - the inverter config clauses are more clear now and base AT/modbus documentation is great!

@s-allius
Copy link
Owner

s-allius commented Sep 3, 2024

Hi il-steffen,

thank you for your great feedback. I will have a deep look at it at the weekend and will use it for improvements...

Cheers Stefan

@s-allius
Copy link
Owner

s-allius commented Sep 7, 2024

Hi il-steffen,

at the start of the project I had decided to publish this project only as a Docker image. This way I avoid dependency issues as the container contains everything that is needed. For development, I always use the latest Phython release (currently 3.12.5), which also runs all unit tests. I don't bother with older versions, as I don't think this is necessary for containerization.

Configuration

2.1 You are right, you only need this for updates or if you want to use the TSUN apps. From a security point of view, it would be better not to configure these connections, as this sends a lot of data to TSUN (e.g. the network configuration, ...)

2.2 Yes, I listen for the Home Assistant status in these MQTT topics. When the status changes to online, I register all devices with Home Assistant. With this approach, I don't need to send topics as retaining messages. This avoids a lot of problems

2.3 At the moment, you only need to configure the IP address and the port in 'Client Mode' (if it is not the default value 8899). The rest is for later proxy versions, or when not using Client Mode. For example, we could implement a connection to the TSUN Cloud even if the inverter is running in Client Mode. Then we can filter critical information like WiFi password, which is not possible with an SSL connection to TSUN.

2.4 Modbus pollingis for inverters which are connected in server mode to get information faster from the device. In server mode the inverter sends data only every 5 minutes. With the polling you get data every 60 seconds.
The client mode use the Modbus polling automatically, since the inverter doesn't send any data in this mode. The data polling time is about 30 seconds then. See also: https://github.com/s-allius/tsun-gen3-proxy/wiki/Operation-Modes-Overview

@il-steffen
Copy link
Author

il-steffen commented Sep 7, 2024 via email

@s-allius
Copy link
Owner

s-allius commented Sep 7, 2024

Yes, with pleasure. I just made it easy for myself, as Phython and Docker were new territory for me. I didn't bother with modules and the Pip installation.
A pip installation is certainly a welcome alternative for many, as Docker requires a lot of knowledge.

If you need help or have any questions, I'm here to help

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