Commit Graph

519 Commits

Author SHA1 Message Date
Stefan Allius
2b8dacb0de Dev 0.11 (#175)
* 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
2024-08-26 23:49:23 +02:00
Stefan Allius
5db3fbf495 Update README.md (#173) 2024-08-26 21:28:44 +02:00
Stefan Allius
58b42f7d7c SonarCloud setup (#168)
* 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
2024-08-23 21:24:01 +02:00
Stefan Allius
db1169f61f Update README.md (#156)
add modbus_polling to example config
2024-08-10 16:49:18 +02:00
Stefan Allius
383be10e87 Hotfix v0.10.1: fix displaying the version string at startup and in HA (#155)
* Version 0.10.0 no longer displays the version string (#154)

Fixes #153
v0.10.1
2024-08-10 14:18:25 +02:00
Stefan Allius
b364fb3f8e Dev 0.10 (#151)
* S allius/issue117 (#118)

* add shutdown flag

* add more register definitions

* add start commando for client side connections

* add first support for port 8899

* fix shutdown

* add client_mode configuration

* read client_mode config to setup inverter connections

* add client_mode connections over port 8899

* add preview build

* Update README.md

describe the new client-mode over port 8899 for GEN3PLUS

* MODBUS: the last digit of the inverter version is a hexadecimal number (#121)

* S allius/issue117 (#122)

* add shutdown flag

* add more register definitions

* add start commando for client side connections

* add first support for port 8899

* fix shutdown

* add client_mode configuration

* read client_mode config to setup inverter connections

* add client_mode connections over port 8899

* add preview build

* add documentation for client_mode

* catch os error and log thme with DEBUG level

* update changelog

* make the maximum output coefficient configurable (#124)

* S allius/issue120 (#126)

* add config option to disable the modbus polling

* read more modbus regs in polling mode

* extend connection timeouts if polling mode is disabled

* update changelog

* S allius/issue125 (#127)

* fix linter warning

* move sequence diagramm to wiki

* catch asyncio.CancelledError

* S allius/issue128 (#130)

* set Register.NO_INPUTS fix to 4 for GEN3PLUS

* don't set Register.NO_INPUTS per MODBUS

* fix unit tests

* register OUTPUT_COEFFICIENT at HA

* update changelog

* - Home Assistant: improve inverter status value texts

* - GEN3: add inverter status

* on closing send outstanding MQTT data to the broker

* force MQTT publish on every conn open and close

* reset inverter state on close

- workaround which reset the inverter status to
  offline when the inverter has a very low
  output power on connection close

* improve client modified
- reduce the polling cadence to 30s
- set controller statistics for HA

* client mode set controller IP for HA

* S allius/issue131 (#132)

* Make __publish_outstanding_mqtt public

* update proxy counter

- on client mode connection establishment or
  disconnecting update tje counection counter

* Update README.md (#133)

* reset inverter state on close

- workaround which reset the inverter status to
  offline when the inverter has a very low
  output power on connection close

* S allius/issue134 (#135)

* add polling invertval and method ha_remove()

* add client_mode arg to constructors

- add PollingInvervall

* hide some topics in client mode

- we hide topics in HA by sending an empty register
  MQTT topic during HA auto configuration

* add client_mode value

* update class diagram

* fix modbus close handler

- fix empty call and cleanup que
- add unit test

* don't sent an initial 1710 msg in client mode

* change HA icon for inverter status

* increase test coverage

* accelerate timer tests

* bump aiomqtt and schema to latest release (#137)

* MQTT timestamps and protocol improvements (#140)

* add TS_INPUT, TS_GRID and TS_TOTAL

* prepare MQTT timestamps

- add _set_mqtt_timestamp method
- fix hexdump printing

* push dev and debug images to docker.io

* add unix epoche timestamp for MQTT pakets

* set timezone for unit tests

* set name für setting timezone step

* trigger new action

* GEN3 and GEN3PLUS: handle multiple message

- read: iterate over the receive buffer
- forward: append messages to the forward buffer
- _update_header: iterate over the forward buffer

* GEN3: optimize timeout handling

- longer timeout in state init and reveived
- got to state pending only from state up

* update changelog

* cleanup

* print coloured logs

* Create sonarcloud.yml (#143)

* Update sonarcloud.yml

* Update sonarcloud.yml

* Update sonarcloud.yml

* Update sonarcloud.yml

* Update sonarcloud.yml

* build multi arch images with sboms (#146)

* don't send MODBUS request when state is not up (#147)

* adapt timings

* don't send MODBUS request when state is note up

* adapt unit test

* make test code more clean (#148)

* Make test code more clean (#149)

* cleanup

* Code coverage for SonarCloud (#150)


* cleanup code and unit tests

* add test coverage for SonarCloud

* configure SonarCloud

* update changelog

* Do no build on *.yml changes

* prepare release 0.10.0

* disable MODBUS_POLLING for GEN§PLUS in example config

* bump aiohttp to version 3.10.2

* code cleanup

* Fetch all history for all tags and branches
v0.10.0
2024-08-09 23:16:47 +02:00
Stefan Allius
a42ba8a8c6 Dev 0.9 (#115)
* make timestamp handling stateless

* adapt tests for stateless timestamp handling

* initial version

* add more type annotations

* add more type annotations

* fix Generator annotation for ha_proxy_confs

* fix names of issue branches

* add more type annotations

* don't use depricated varn anymore

* don't mark all test as async

* fix imports

* fix solarman unit tests

- fake Mqtt class

* print image build time during proxy start

* update changelog

* fix pytest collect warning

* cleanup msg_get_time handler

* addapt unit test

* label debug images with debug

* dump droped packages

* fix warnings

* add systemtest with invalid start byte

* update changelog

* update changelog

* add exposed ports and healthcheck

* add wget for healthcheck

* add aiohttp

* use config validation for healthcheck

* add http server for healthcheck

* calculate msg prossesing time

* add healthy check methods

* fix typo

* log ConfigErr with DEBUG level

* Update async_stream.py

- check if processing time is < 5 sec

* add a close handler to release internal resources

* call modbus close hanlder on a close call

* add exception handling for forward handler

* update changelog

* isolate Modbus fix

* cleanup

* update changelog

* add heaithy handler

* log unrelease references

* add healtcheck

* complete exposed port list

* add wget for healtcheck

* add aiohttp

* use Enum class for State

* calc processing time for healthcheck

* add HTTP server for healthcheck

* cleanup

* Update CHANGELOG.md

* updat changelog

* add docstrings to state enum

* set new state State.received

* add healthy method

* log healthcheck infos with DEBUG level

* update changelog

* S allius/issue100 (#101)

* detect dead connections

- disconnect connection on Msg receive timeout
- improve connection trace (add connection id)

* update changelog

* fix merge conflict

* fix unittests

* S allius/issue108 (#109)

* add more data types

* adapt unittests

* improve test coverage

* fix linter warning

* update changelog

* S allius/issue102 (#110)

* hotfix: don't send two MODBUS commands together

* fix unit tests

* remove read loop

* optional sleep between msg read and sending rsp

* wait after read 0.5s before sending a response

* add pending state

* fix state definitions

* determine the connection timeout by the conn state

* avoid sending MODBUS cmds in the inverter's reporting phase

* update changelog

* S allius/issue111 (#112)

Synchronize regular MODBUS commands with the status of the inverter to prevent the inverter from crashing due to unexpected packets.

* inital checkin

* remove crontab entry for regular MODBUS cmds

* add timer for regular MODBUS polling

* fix Stop method call for already stopped timer

* optimize MB_START_TIMEOUT value

* cleanup

* update changelog

* fix buildx warnings

* fix timer cleanup

* fix Config.class_init()

- return error string or None
- release Schema structure after building thr config

* add quit flag to docker push

* fix timout calculation

* rename python to debugpy

* add asyncio log

* cleanup shutdown
- stop webserver on shutdown
- enable asyncio debug mode for debug versions

* update changelog

* update changelog

* fix exception in MODBUS timeout callback

* update changelog
v0.9.0
2024-07-01 23:41:56 +02:00
Stefan Allius
f3e69ff217 Dev 0.8 (#107)
* S allius/issue102 (#103)

* hotfix: don't send two MODBUS commands together

* Update README.md

Exchange logger fw version with the real inverter fw version in the compatibility table

* Update python-app.yml

run also on pushes to issue branches
fix name for issues branches

* S allius/issue104 (#105)

* Update README.md

Exchange logger fw version with the real inverter fw version in the compatibility table

* Update python-app.yml

run also on pushes to issue branches
fix name for issues branches

* fix forwarding of MODBUS responses

* fix unit tests

* update changelog

* update changelog
v0.8.1
2024-06-21 18:41:54 +02:00
Stefan Allius
a3c054d2b1 Dev 0.8 (#106)
* S allius/issue102 (#103)

* hotfix: don't send two MODBUS commands together

* Update README.md

Exchange logger fw version with the real inverter fw version in the compatibility table

* Update python-app.yml

run also on pushes to issue branches
fix name for issues branches

* S allius/issue104 (#105)

* Update README.md

Exchange logger fw version with the real inverter fw version in the compatibility table

* Update python-app.yml

run also on pushes to issue branches
fix name for issues branches

* fix forwarding of MODBUS responses

* fix unit tests

* update changelog
2024-06-21 18:12:48 +02:00
Stefan Allius
c34b33ed5f Update python-app.yml
fix name for issues branches
2024-06-08 23:39:28 +02:00
Stefan Allius
0a18918326 Update python-app.yml
run also on pushes to issue branches
2024-06-08 23:23:56 +02:00
Stefan Allius
aa3bb4a1fa Merge pull request #86 from s-allius/dev-0.8.0
Dev 0.8.0
v0.8.0
2024-06-07 19:51:55 +02:00
Stefan Allius
a62864218d update for version 0.8.0 2024-06-07 19:48:41 +02:00
Stefan Allius
0b2631c162 beautify some traces 2024-06-07 19:27:36 +02:00
Stefan Allius
c59bd16664 change log level for some traces 2024-06-05 22:01:48 +02:00
Stefan Allius
039a021cda cleanup trace output 2024-06-04 21:55:57 +02:00
Stefan Allius
49e2dfbd86 optimize docker-compose.yaml file 2024-06-04 20:27:15 +02:00
Stefan Allius
e6ecf5911b remove the external network expectation 2024-06-04 20:00:39 +02:00
Stefan Allius
6e1ed5d1e7 check the docker-compose.yaml file as last step 2024-06-03 20:59:21 +02:00
Stefan Allius
ad885e9644 add Y47 serial numbers 2024-06-03 20:40:35 +02:00
Stefan Allius
8f81ceda98 fix warnings and remove obsolete version 2024-06-03 20:28:14 +02:00
Stefan Allius
8204cae2b1 improve logging output 2024-06-03 19:52:37 +02:00
Stefan Allius
8baa68e615 fix typo (wrong bracket) 2024-06-02 14:08:06 +02:00
Stefan Allius
56f36e9f3f build release candidate as paket v0.8.0-rc.1 2024-05-31 23:09:33 +02:00
Stefan Allius
5b60d5dae1 cleanup 2024-05-31 23:09:14 +02:00
Stefan Allius
c1c38ab5c7 Merge pull request #82 from s-allius/s-allius/issue77
S allius/issue77
2024-05-31 20:17:40 +02:00
Stefan Allius
ec4261ae84 Merge branch 'dev-0.8.0' into s-allius/issue77 2024-05-31 20:17:03 +02:00
Stefan Allius
be57d11214 update changelog 2024-05-31 20:13:45 +02:00
Stefan Allius
685c2dc07b fix unit tests 2024-05-31 20:10:22 +02:00
Stefan Allius
d27fe09006 reduce size of trace file
- trace heartbeat and regular modbus pakets
  only with log level DBEUG
- don't forwar akc pakets from tsun to inverter
  since we answered in before
2024-05-31 20:03:21 +02:00
Stefan Allius
e850a8c534 set tracer log level by environment value 2024-05-31 20:02:21 +02:00
Stefan Allius
33f215def2 Update README.md
fix typo
2024-05-30 20:30:48 +02:00
Stefan Allius
4be726166e Merge pull request #81 from s-allius/s-allius/issue80
S allius/issue80
2024-05-30 19:57:45 +02:00
Stefan Allius
20f4fd647c update config example 2024-05-30 19:44:54 +02:00
Stefan Allius
407c1ceb2b control access via AT commands 2024-05-30 19:40:25 +02:00
Stefan Allius
c6eecb4791 add missing testcases 2024-05-30 19:32:53 +02:00
Stefan Allius
87d59d046f add AT_COMMAND_BLOCKED counter 2024-05-30 19:32:14 +02:00
Stefan Allius
063850c7fb add allow and block filter for AT+ commands 2024-05-30 18:38:05 +02:00
Stefan Allius
17c33601a0 Merge pull request #79 from s-allius/s-allius/issue77
S allius/issue77
2024-05-28 22:02:54 +02:00
Stefan Allius
3980ac013b catch all OSError errors in the read loop 2024-05-28 21:55:42 +02:00
Stefan Allius
66657888dd add log_level support for modbus commands 2024-05-28 19:32:20 +02:00
Stefan Allius
ab9e798152 add typing 2024-05-28 19:30:58 +02:00
Stefan Allius
fdf3475909 fix unit test 2024-05-27 20:56:03 +02:00
Stefan Allius
edc2c12b5b Send MQTT topic for responses to AT+ commands 2024-05-27 20:52:06 +02:00
Stefan Allius
5c6f9e7414 increase test coverage to 100% 2024-05-23 19:52:55 +02:00
Stefan Allius
0fc74b0d19 improve unit test 2024-05-22 22:54:23 +02:00
Stefan Allius
87cc3fb205 fix frong MQTT not found logs 2024-05-22 22:53:52 +02:00
Stefan Allius
8fc5eb3670 log MQTT to data topic 2024-05-22 22:53:04 +02:00
Stefan Allius
55fc834a1e reduce default loggings 2024-05-22 22:52:02 +02:00
Stefan Allius
da2388941e allow only one MODBUS retry
- More than one retry usually makes no sense, as
  random errors are usually corrected. If the
  first retry also fails, the chance that a second
  or third retry will be successful is very small
2024-05-21 19:37:55 +02:00