Coder Social home page Coder Social logo

s-allius / tsun-gen3-proxy Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 4.0 459 KB

This proxy enables a reliable connection between TSUN third generation inverters (eg. TSOL MS600, MS800, MS2000) and an MQTT broker to integrate the inverter into typical home automations.

Home Page: https://s-allius.github.io/tsun-gen3-proxy/

License: BSD 3-Clause "New" or "Revised" License

Dockerfile 0.88% Python 97.67% Shell 1.45%
docker home-assistant inverter-monitor mqtt python3 tsun

tsun-gen3-proxy's People

Contributors

lenzgr avatar limes007 avatar s-allius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tsun-gen3-proxy's Issues

Do not register non-existent inverter inputs in HA

The TSOL MS-600 software sends values from 4 inputs, and the proxy registers them all with the home assistant. However, the inverter has only 2 inputs, so unhelpful values appear on the Home Assistant dashboard.

Only existing inputs should be registered

data_type 76 not supported

Thank you for sharing your TSUN proxy with us.

In the log file I see the following error

ERROR | root | Infos.parse: data_type: 76 not supported

Is this the intended behavior or do I need to change some setting to get rid of this error?

Self-sufficient island operation for GEN3PLUS inverters

In version 0.6.0 GEN3 Plus Inverters only works if solarman.enabledin the 'confidence-toml' file is set to 'true'

In addition to this proxy mode, island mode is also to be implemented so that the GEN3 Plus inverters can also be monitored via MQTT without an Internet connection to the TSUN Cloud

'Inverter Connection Count' don't decrease after connection lost

With Version 0.4.0

The new counter 'Inverter Connection Count' is not counted down after sunset. Presumably, the updated counter is no longer transmitted to the MQTT broker after the connection is terminated by the inverter and therefore remains incorrect until sunrise.

Exception during parsing the contact info message

The following exceptions occur with the current main branch:

'2023-12-24 11:03:15 ERROR | conn | Exception for ('logger.talent-monitoring.com', 5005):
Traceback (most recent call last):
  File "/home/tsun-proxy/async_stream.py", line 31, in loop
    await self.__async_read()
  File "/home/tsun-proxy/async_stream.py", line 72, in __async_read
    self.read()                # call read in parent class
    ^^^^^^^^^^^
  File "/home/tsun-proxy/messages.py", line 164, in read
    self.__dispatch_msg()
  File "/home/tsun-proxy/messages.py", line 271, in __dispatch_msg
�
)
  File "/home/tsun-proxy/messages.py", line 288, in msg_contact_info
    self.__process_contact_info()
  File "/home/tsun-proxy/messages.py", line 302, in __process_contact_info
    result = struct.unpack_from(f'!{name_len+1}pB', self._recv_buffer,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: unpack_from requires a buffer of at least 26 bytes for unpacking 3 bytes at offset 23 (actual buffer size is 24)
'
'2023-12-24 11:03:15 DEBUG | conn | in AsyncStream.close() l('172.28.1.32', 40620) | r('47.254.132.252', 5005)'

Since Home Assistant Core Update and TSUN Update no Data Transfer

Aktuell funktioniert bei mir die Übertragung nicht mehr ordnungsgemäß.
Sowohl nach TSUN noch an Home Assistant.
Im MQTT sehe ich, dass die Config übertragen wird, jedoch die Werte werden nicht übermittelt.
Im Proxy Home Assistant Eintrag wird ein Internal SW Error hoch gezählt und die Verbundenen Controller zählen auf 300 und höher nach Oben.

Due to the proxy, the TSUN cloud always shows the inverter status as offline

Observed with all versions since version 0.5:

For some time now, the TSUN apps and the TSUN website have always shown the inverter as offline, although status data and measured values are displayed correctly.
This may be due to an interruption in the connection to the TSUN Cloud, especially if the connection to the inverter is maintained

support for sub devices

Home Assistant supports configuration of devices to which the individual sensors are assigned. For devices that contain multiple logical units, sub devices are also supported.
For the TSUN inverters, this concept is suitable and the following devices should be created:

  • Inverter
  • Controller with Wifi/WWAN
  • 1 to 4 inputs for solar modules

This means that not all sensors are assigned directly to the inverter and you can use the individual sub-devices on the dashboards as required.

Running Proxy with host UID and GUID

The container runs in non-root mode. It is important that the proxy has the correct UID. Otherwise, reading and writing files on the host volumes is not possible.

Needed:

  1. better documentation
    Even better:
  2. an automatic mode, so that images can run in any environment, without reconfiguring the UID.

send autoconfig on HA restart

If the Home Assistant Service has restarted, the proxy should send his autoconfig MQTT topics again. This assures that both are in sync.

Reset the daily generation values at midnight

The measured values for daily energy production increase continuously and start from zero again with the new day. Since the proxy only sends values to the MQTT broker and the Home Assistant when it receives values from the inverter, the meters are only reset at the start of solar production and not at midnight.
We should send an MQTT update packet at least at midnight so that the meters are reset at the start of a new day. See the red arrow in the picture

Bild 10 12 23 um 19 25

GEN3PLUS: Consideration of subsequently delivered data records

The GEN3PLUS inverters sends after a connection setup or reestablishment, the missing data together with the realtime data. In the Power on Timegraph we will see glitches in that moment:
Bild 20 04 24 um 01 53

We want to handle this situation and send the non realtime data with a proper timestamp to home assistant, so that they will be inserted in the database at the proper place. Then we should see a permanent growing Power on Timegraph.

Problem to start the container

Hi,

first, thank you for this amazing promising project!
I am looking forward to use this in my home setup...

Unfortunately I am not able to start the container as you described the startup process.
I build the image and tried to start the container by running:
docker run --dns '192.168.212.20' --env 'UID=1000' -p '5005:5005' -p '10000:10000' -v /srv/tsun-proxy/config:/home/tsun-proxy/config -v /srv/tsun-proxy/log:/home/tsun-proxy/log tsun-proxy

And I get the following:

######################################################
# prepare: 'tsun-proxy' Version:
# for running with UserID:1000, GroupID:1000
#
# create user
######################################################
#
'2024-04-08 20:20:23  INFO | root | Server "tsun-proxy - " will be started'
'2024-04-08 20:20:23  INFO | root | Initialize proxy statistics'
Traceback (most recent call last):
  File "/home/tsun-proxy/./server.py", line 83, in <module>
    Inverter.class_init()
  File "/home/tsun-proxy/inverter.py", line 21, in class_init
    cls.entity_prfx = ha['entity_prefix'] + '/'
                      ~~^^^^^^^^^^^^^^^^^
KeyError: 'entity_prefix'

Is this an error in the code or on my side?

Background:
I tried to use a lxc container and a debian vm under proxmox virtualization.

Btw: Do you have a donation option?

Proxy counters don't work after restart properly

With version 0.4.3:
Proxy counters do not work properly after restart.

  1. After a proxy restart or update, the proxy counters are registered by establishing the first inverter connection. The expectation is that this happens directly at proxy start.

  2. The counter values are in the status 'unknown' until the first sunset. here is the expectation, that the counter will be synchronized directly after the proxy start.

Detect loop in the DNS setup

If the DNS name logger.talent-monitoring.com is resolved to itself by the proxy, then countless connections are established through this loop until the system crashes.
This is a misconfiguration of the DNS setup and should be recognized by the proxy and the outgoing connection should not be established. The proxy then runs and at least delivers the data to the MQTT broker.

Send internal proxy states to Home-Assistant

For getting a better view on the proxy, we should add the proxy as a device to Home-Assistant:

possible data to show:

  • Proxy version
  • number of connection
  • connection time
  • events like connection errors, establishments, ...

also wishful:

  • a switch to disable the connections to the internet

Handle connection timeouts to TSUN cloud

In forwarding mode, we wait for the responses from the TSUN cloud.

For GEN3 inverters we need the timestamp in the proper timezone. Since TSUN don't handle the summertime change correct and there is no time shift allowed between the inverter and the cloud, we want the proper timestamp from the cloud.
However, if there is a configuration problem or the cloud is unavailable, we will no longer receive a response with the correct timestamp from the cloud.

In this situation we want an error handling wich sends the local time to the inverter. Otherwise the logging on Home Assistant will also stop.

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.