Files
tsun-gen3-proxy/CHANGELOG.md
Stefan Allius c956c13d13 Dev 0.11 (#200)
* Code Cleanup (#158)


* print coverage report

* create sonar-project property file

* install all py dependencies in one step

* code cleanup

* reduce cognitive complexity

* do not build on *.yml changes

* optimise versionstring handling (#159)

- Reading the version string from the image updates
  it even if the image is re-pulled without re-deployment

* fix linter warning

* exclude *.pyi filese

* ignore some rules for tests

* cleanup (#160)

* Sonar qube 3 (#163)

fix SonarQube warnings in modbus.py

* Sonar qube 3 (#164)


* fix SonarQube warnings

* Sonar qube 3 (#165)

* cleanup

* Add support for TSUN Titan inverter
Fixes #161


* fix SonarQube warnings

* fix error

* rename field "config"

* SonarQube reads flake8 output

* don't stop on flake8 errors

* flake8 scan only app/src for SonarQube

* update flake8 run

* ignore flake8 C901

* cleanup

* fix linter warnings

* ignore changed *.yml files

* read sensor list solarman data packets

* catch 'No route to' error and log only in debug mode

* fix unit tests

* add sensor_list configuration

* adapt unit tests

* fix SonarQube warnings

* Sonar qube 3 (#166)

* add unittests for mqtt.py

* add mock

* move test requirements into a file

* fix unit tests

* fix formating

* initial version

* fix SonarQube warning

* Sonar qube 4 (#169)

* add unit test for inverter.py

* fix SonarQube warning

* Sonar qube 5 (#170)

* fix SonarLints warnings

* use random IP adresses for unit tests

* Docker: The description ist missing (#171)

Fixes #167

* S allius/issue167 (#172)

* cleanup

* Sonar qube 6 (#174)

* test class ModbusConn

* Sonar qube 3 (#178)

* add more unit tests

* GEN3: don't crash on overwritten msg in the receive buffer

* improve test coverage und reduce test delays

* reduce cognitive complexity

* fix merge

* fix merge conflikt

* fix merge conflict

* S allius/issue182 (#183)

* GEN3: After inverter firmware update the 'Unknown Msg Type' increases continuously
Fixes #182

* add support for Controller serial no and MAC

* test hardening

* GEN3: add support for new messages of version 3 firmwares

* bump libraries to latest versions

- bump aiomqtt to version 2.3.0
- bump aiohttp to version 3.10.5

* improve test coverage

* reduce cognective complexity

* fix target preview

* remove dubbled fixtures

* increase test coverage

* Update README.md (#185)

update badges

* S allius/issue186 (#187)

* Parse more values in Server Mode
Fixes #186

* read OUTPUT_COEFFICIENT and MAC_ADDR in SrvMode

* fix unit test

* increase test coverage

* S allius/issue186 (#188)

* increase test coverage

* update changelog

* add dokumentation

* change default config

* Update README.md (#189)

Config file is now foldable

* GEN3: Invalid Contact Info Msg (#192)

Fixes #191

* Refactoring async stream (#194)

* GEN3: Invalid Contact Info Msg
Fixes #191

* introduce ifc with FIFOs

* add object factory

* use AsyncIfc class with FIFO

* declare more methods as classmethods

* - refactoring

- remove _forward_buffer
- make async_write private

* remove _forward_buffer

* refactoring

* avoid mqtt handling for invalid serial numbers

* add two more callbacks

* FIX update_header_cb handling

* split AsyncStream in two classes

* split ConnectionG3(P) in server and client class

* update class diagramm

* refactor server creation

* remove duplicated imports

* reduce code duplication

* move StremPtr instances into Inverter class

* resolution of connection classes

- remove ConnectionG3Client
- remove ConnectionG3Server
- remove ConnectionG3PClient
- remove ConnectionG3PServer

* fix server connections

* fix client loop closing

* don't overwrite self.remote in constructor

* update class diagramm

* fixes

- fixes null pointer accesses
- initalize AsyncStreamClient with proper
  StreamPtr instance

* add close callback

* refactor close handling

* remove connection classes

* move more code into InverterBase class

* remove test_inverter_base.py

* add abstract inverter interface class

* initial commit

* fix sonar qube warnings

* rename class Inverter into Proxy

* fix typo

* move class InverterIfc into a separate file

* add more testcases

* use ProtocolIfc class

* add unit tests for AsyncStream class

* icrease test coverage

* reduce cognitive complexity

* increase test coverage

* increase tes coverage

* simplify heartbeat handler

* remove obsolete tx_get method

* add more unittests

* update changelog

* remove __del__ method for proper gc runs

* check releasing of ModbusConn instances

* call garbage collector to release unreachable objs

* decrease ref counter after the with block

* S allius/issue196 (#198)

* fix healthcheck

- on infrastructure with IPv6 support localhost
  might be resolved to an IPv6 adress. Since the
  proxy only support IPv4 for now, we replace
  localhost by 127.0.0.1, to fix this

* merge from main
2024-10-13 18:12:10 +02:00

12 KiB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[unreleased]

  • fix healthcheck on infrastructure with IPv6 support #196
  • refactoring: cleaner architecture, increase test coverage
  • Parse more values in Server Mode #186
  • GEN3: add support for new messages of version 3 firmwares #182
  • add support for controller MAC and serial number
  • GEN3: don't crash on overwritten msg in the receive buffer
  • Reading the version string from the image updates it even if the image is re-pulled without re-deployment

[0.10.1] - 2024-08-10

  • fix displaying the version string at startup and in HA #153

[0.10.0] - 2024-08-09

  • bump aiohttp to version 3.10.2
  • add SonarQube and code coverage support
  • don't send MODBUS request when state is note up; adapt timeouts #141
  • build multi arch images with sboms #144
  • add timestamp to MQTT topics #138
  • improve the message handling, to avoid hangs
  • GEN3: allow long timeouts until we received first inverter data (not only device data)
  • bump aiomqtt to version 2.2.0
  • bump schema to version 0.7.7
  • Home Assistant: improve inverter status value texts
  • GEN3: add inverter status
  • fix flapping registers #128
  • register OUTPUT_COEFFICIENT at HA
  • GEN3: INVERTER_STATUS,
  • add config option to disable the MODBUS polling #120
  • make the maximum output coefficient configurable #123
  • cleanup shutdown
  • add preview build
  • MODBUS: the last digit of the inverter version is a hexadecimal number #119
  • GEN3PLUS: add client_mode connection on port 8899 #117

[0.9.0] - 2024-07-01

  • fix exception in MODBUS timeout callback

[0.9.0-RC1] - 2024-06-29

  • add asyncio log and debug mode
  • stop the HTTP server on shutdown gracefully
  • Synchronize regular MODBUS commands with the status of the inverter to prevent the inverter from crashing due to unexpected packets. #111
  • GEN3: avoid sending MODBUS commands to the inverter during the inverter's reporting phase
  • GEN3: determine the connection timeout based on the connection state
  • GEN3: support more data encodings for DSP version V5.0.17 #108
  • detect dead connections #100
  • improve connection logging wirt a unique connection id
  • Add healthcheck, readiness and liveness checks #91
  • MODBUS close handler releases internal resource #93
  • add exception handling for message forwarding #94
  • GEN3: make timestamp handling stateless, to avoid blocking when the TSUN cloud is down #56
  • GEN3PLUS: dump invalid packages with wrong start or stop byte
  • label debug imagages als debug
  • print imgae build time during proxy start
  • add type annotations
  • improve async unit test and fix pytest warnings
  • run github tests even for pulls on issue branches

[0.8.1] - 2024-06-21

  • Fix MODBUS responses are dropped and not forwarded to the TSUN cloud #104
  • GEN3: Fix connections losts due MODBUS requests #102

[0.8.0] - 2024-06-07

  • improve logging: add protocol or node_id to connection logs
  • improve logging: log ignored AT+ or MODBUS commands
  • improve tracelog: log level depends on message type and source
  • fix typo in docker-compose.yaml and remove the external network definition
  • trace heartbeat and regular modbus pakets witl log level DEBUG
  • GEN3PLUS: don't forward ack paket from tsun to the inverter
  • GEN3PLUS: add allow and block filter for AT+ commands
  • catch all OSError errors in the read loop
  • log Modbus traces with different log levels
  • add Modbus fifo and timeout handler
  • build version string in the same format as TSUN for GEN3 inverters
  • add graceful shutdown
  • parse Modbus values and store them in the database
  • add cron task to request the output power every minute
  • GEN3PLUS: add MQTT topics to send AT commands to the inverter
  • add MQTT topics to send Modbus commands to the inverter
  • convert data collect interval to minutes
  • add postfix for rc and dev versions to the version number
  • change logging level to DEBUG for some logs
  • remove experimental value Register.VALUE_1
  • format Register.POWER_ON_TIME as integer
  • ignore catch-up values from the inverters for now

[0.7.0] - 2024-04-20

  • GEN3PLUS: fix temperature values
  • GEN3PLUS: read corect firmware and logger version
  • GEN3PLUS: add inverter status
  • GEN3PLUS: fix encoding of power on time value
  • GEN3PLUS: fix glitches in inverter data after connection establishment see: #53
  • improve docker container labels
  • GEN3PLUS: add timestamp of inverter data into log
  • config linter for *.md files
  • switch to aiomqtt version 2.0.1
  • refactor unittest and increase testcoverage
  • GEN3PLUS: add experimental handler for ÀT commands
  • GEN3PLUS: implement self-sufficient island support see: #42
  • Improve error messages on config errors see: #46
  • Prepare support of inverters with 6 MTPPs
  • Clear Daily Generation values at midnigth see: #32
  • Read pv module details from config file and use it for the Home Assistant registration see: #43
  • migrate to aiomqtt version 2.0.0 see: #44

[0.6.0] - 2024-04-02

  • Refactoring to support Solarman V5 protocol
  • Add unittest for Solarman V5 implementation
  • Handle checksum errors
  • Handle wrong start or Stop bytes
  • Watch for AT commands and signal their occurrence to HA
  • Build inverter type names for MS-1600 .. MS-2000
  • Build device name for Solarman logger module

[0.5.5] - 2023-12-31

  • Fixed #33
  • Fixed detection of the connected inputs/MPPTs
  • Preparation for overwriting received data
  • home assistant improvements:
    • Add unit 'W' to the Rated Power value for home assistant
    • Collect_Interval, Connect_Count and Data_Up_Interval as diagnostic value and not as graph
    • Add data acquisition interval
    • Add number of connections
    • Add communication type
    • Add 'Internal SW Exception' counter

[0.5.4] - 2023-11-22

  • hardening remove dangerous commands from busybox
  • add OTA start message counter
  • add message handler for over the air updates
  • add unit tests for ota messages
  • add unit test for int64 data type
  • cleanup msg_get_time_handler
  • remove python packages setuptools, wheel, pip from final image to reduce the attack surface

[0.5.3] - 2023-11-12

  • remove apk packet manager from the final image
  • send contact info every time a client connection is established
  • use TSUN timestamp instead of local time, as TSUN also expects Central European Summer Time in winter

[0.5.2] - 2023-11-09

  • add int64 data type to info parser
  • allow multiple calls to Message.close()
  • check for race cond. on closing and establishing client connections

[0.5.1] - 2023-11-05

  • fixes f-string by limes007
  • add description for dns settings by limes007

[0.5.0] - 2023-11-04

  • fix issue #21
  • register proxy dev as soon as the MQTT connection is established
  • increase test coverage of the Messages class
  • add error counter for unknown control bytes
  • lint code with flake8

[0.4.3] - 2023-10-26

  • fix typos by Lenz Grimmer
  • catch mqtt errors, so we can forward messages to tsun even if the mqtt broker is not reachable
  • avoid resetting the daily generation counters even if the inverter sends zero values after reconnection

[0.4.2] - 2023-10-21

  • count unknown data types in received messages
  • count definition errors in our internal tables
  • increase test coverage of the Infos class to 100%
  • avoid resetting the daily generation counters even if the inverter sends zero values at sunset

[0.4.1] - 2023-10-20

  • fix issue #18
  • initialize the proxy statistics
  • avoid resetting total generation counters

[0.4.0] - 2023-10-16

  • fix issue #8
  • implement #10
  • fix: don't dispatch ignored messages so that they are not forwarded
  • add systemtests
  • fix unit tests, which were broken since version 0.3.0
  • add proxy device to home assistant
  • add statistic counter to proxy device
  • support multiple inverter registration at home assistant

[0.3.0] - 2023-10-10

Due to the definition of values for diagnostics, the MQTT devices of controller and inverter should be deleted in the Home Assistant before updating to version '0.3.0'. After the update, these are automatically created again. The measurement data is retained.

Changes

  • optimize and reduce logging
  • switch to pathon 3.12
  • classify some values for diagnostics

[0.2.0] - 2023-10-07

This version halves the size of the Docker image and reduces the attack surface for security vulnerabilities, by omitting unneeded code. The feature set is exactly the same as the previous release version 0.1.0.

Changes in 0.2.0

  • move from slim-bookworm to an alpine base image
  • install python requirements with pip wheel
  • disable DEBUG log for releases
  • support building of release candidates

[0.1.0] - 2023-10-06

  • refactoring of the connection classes
  • change user id on startup
  • register MQTT topics to home assistant, even if we have multiple inverters

[0.0.6] - 2023-10-03

  • Bump aiomqtt to version 1.2.1
  • Force MQTT registration when the home assistant has set the status to online again
  • fix control byte output in tx trace
  • dealloc async_stream instances in connection termination

[0.0.5] - 2023-10-01

  • Entity icons updated
  • Prints version on start
  • Prepare for MQTT component != sensor
  • Add MQTT origin

[0.0.4] - 2023-09-30

  • With this patch we ignore the setting 'suggested_area' in config.toml, because it makes no sense with multiple devices. We are looking for a better solution without combining all values into one area again in a later version.

Due to the change from one device to multiple devices in the Home Assistant, the previous MQTT device should be deleted in the Home Assistant after the update to pre-release '0.0.4'. Afterwards, the proxy must be restarted again to ensure that the sub-devices are created completely.

Added in 0.0.4

  • Register multiple devices at home-assistant instead of one for all measurements. Now we register: a Controller, the inverter and up to 4 input devices to home-assistant.

[0.0.3] - 2023-09-28

Added in 0.0.3

  • Fixes Running Proxy with host UID and GUID #2

[0.0.2] - 2023-09-27

Added in 0.0.2

  • Dockerfile opencontainer labels
  • Send voltage and current of inputs to mqtt

[0.0.1] - 2023-09-25

Added in 0.0.1

  • Logger for inverter packets
  • SIGTERM handler for fast docker restarts
  • Proxy as non-root docker application
  • Unit- and system tests
  • Home asssistant auto configuration
  • Self-sufficient island operation without internet

[0.0.0] - 2023-08-21

Added

  • First checkin, the project was born