From 0c10cc32dcb4eb78f2014ca1d6b00c42d3ce4f76 Mon Sep 17 00:00:00 2001 From: Stefan Allius Date: Fri, 11 Oct 2024 20:29:20 +0200 Subject: [PATCH] update changelog --- CHANGELOG.md | 1 + app/proxy.svg | 2 +- app/proxy.yuml | 2 +- app/proxy_2.svg | 536 ++++++++++++++++++++++++----------------------- app/proxy_2.yuml | 6 +- 5 files changed, 283 insertions(+), 264 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eacd121..618da05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +- refactoring: cleaner architecture, increase test coverage - Parse more values in Server Mode [#186](https://github.com/s-allius/tsun-gen3-proxy/issues/186) - GEN3: add support for new messages of version 3 firmwares [#182](https://github.com/s-allius/tsun-gen3-proxy/issues/182) - add support for controller MAC and serial number diff --git a/app/proxy.svg b/app/proxy.svg index 649fe8e..f032452 100644 --- a/app/proxy.svg +++ b/app/proxy.svg @@ -25,7 +25,7 @@ <<AbstractIterMeta>> -__iter__ +__iter__() diff --git a/app/proxy.yuml b/app/proxy.yuml index 21c7d11..dbb5417 100644 --- a/app/proxy.yuml +++ b/app/proxy.yuml @@ -3,7 +3,7 @@ // {generate:true} [note: You can stick notes on diagrams too!{bg:cornsilk}] -[<>||__iter__] +[<>||__iter__()] [Mqtt;<>|ha_restarts;__client;__cb_MqttIsUp|publish();close()] [Proxy|db_stat;entity_prfx;discovery_prfx;proxy_node_id;proxy_unique_id;mqtt:Mqtt;;__ha_restarts|class_init();class_close();;_cb_mqtt_is_up();_register_proxy_stat_home_assistant();_async_publ_mqtt_proxy_stat(key)] diff --git a/app/proxy_2.svg b/app/proxy_2.svg index 51cdaca..6a6fb51 100644 --- a/app/proxy_2.svg +++ b/app/proxy_2.svg @@ -4,413 +4,429 @@ - - + + G - + A0 - - - -You can stick notes -on diagrams too! + + + +You can stick notes +on diagrams too! A1 - -IterRegistry - - -__iter__ + +<<AbstractIterMeta>> + + +__iter__() A14 - -Message - -node_id - -inc_counter() -dec_counter() + +<<ProtocolIfc>> + +_registry + +close() A1->A14 - - + + A2 - -InverterG3 - -addr -remote:StreamPtr -local:StreamPtr - -create_remote() -close() + +InverterG3 + +addr +remote:StreamPtr +local:StreamPtr + +create_remote() +close() A7 - -AsyncStreamServer - -create_remote - -<async>server_loop() -<async>_async_forward() -<async>publish_outstanding_mqtt() -close() + +AsyncStreamServer + +create_remote + +<async>server_loop() +<async>_async_forward() +<async>publish_outstanding_mqtt() +close() A2->A7 - - - -local + + + +local A8 - -AsyncStreamClient - - -<async>client_loop() -<async>_async_forward()) + +AsyncStreamClient + + +<async>client_loop() +<async>_async_forward()) A2->A8 - - -remote + + +remote A3 - -InverterG3P - -addr -remote:StreamPtr -local:StreamPtr - -create_remote() -close() + +InverterG3P + +addr +remote:StreamPtr +local:StreamPtr + +create_remote() +close() A3->A7 - - - -local + + + +local A3->A8 - - -remote + + +remote A4 - -<<AsyncIfc>> - - -set_node_id() -get_conn_no() -tx_add() -tx_flush() -tx_get() -tx_peek() -tx_log() -tx_clear() -tx_len() -fwd_add() -fwd_log() -rx_get() -rx_peek() -rx_log() -rx_clear() -rx_len() -rx_set_cb() -prot_set_timeout_cb() + +<<AsyncIfc>> + + +set_node_id() +get_conn_no() +tx_add() +tx_flush() +tx_get() +tx_peek() +tx_log() +tx_clear() +tx_len() +fwd_add() +fwd_log() +rx_get() +rx_peek() +rx_log() +rx_clear() +rx_len() +rx_set_cb() +prot_set_timeout_cb() A5 - -AsyncIfcImpl - -fwd_fifo:ByteFifo -tx_fifo:ByteFifo -rx_fifo:ByteFifo -conn_no:Count -node_id -timeout_cb + +AsyncIfcImpl + +fwd_fifo:ByteFifo +tx_fifo:ByteFifo +rx_fifo:ByteFifo +conn_no:Count +node_id +timeout_cb A4->A5 - - + + A6 - -AsyncStream - -reader -writer -addr -r_addr -l_addr - -<async>loop -disc() -close() -healthy() -__async_read() -__async_write() -__async_forward() + +AsyncStream + +reader +writer +addr +r_addr +l_addr + +<async>loop +disc() +close() +healthy() +__async_read() +__async_write() +__async_forward() A5->A6 - - + + A6->A7 - - + + A6->A8 - - + + A9 - -Talent - -ifc:AsyncIfc -conn_no -addr -await_conn_resp_cnt -id_str -contact_name -contact_mail -db:InfosG3 -mb:Modbus -switch - -msg_contact_info() -msg_ota_update() -msg_get_time() -msg_collector_data() -msg_inverter_data() -msg_unknown() -healthy() -close() + +Talent + +ifc:AsyncIfc +conn_no +addr +await_conn_resp_cnt +id_str +contact_name +contact_mail +db:InfosG3 +mb:Modbus +switch + +msg_contact_info() +msg_ota_update() +msg_get_time() +msg_collector_data() +msg_inverter_data() +msg_unknown() +healthy() +close() A9->A2 - - -remote + + +remote A9->A2 - - - -local + + + +local A9->A4 - - -use + + +use A12 - -InfosG3 - - -ha_confs() -parse() + +InfosG3 + + +ha_confs() +parse() A9->A12 - - + + A10 - -SolarmanV5 - -ifc:AsyncIfc -conn_no -addr -control -serial -snr -db:InfosG3P -mb:Modbus -switch - -msg_unknown() -healthy() -close() + +SolarmanV5 + +ifc:AsyncIfc +conn_no +addr +control +serial +snr +db:InfosG3P +mb:Modbus +switch + +msg_unknown() +healthy() +close() A10->A3 - - -remote + + +remote A10->A3 - - - -local + + + +local A10->A4 - - -use + + +use A13 - -InfosG3P - - -ha_confs() -parse() + +InfosG3P + + +ha_confs() +parse() A10->A13 - - + + A11 - -Infos - -stat -new_stat_data -info_dev - -static_init() -dev_value() -inc_counter() -dec_counter() -ha_proxy_conf -ha_conf -ha_remove -update_db -set_db_def_value -get_db_value -ignore_this_device + +Infos + +stat +new_stat_data +info_dev + +static_init() +dev_value() +inc_counter() +dec_counter() +ha_proxy_conf +ha_conf +ha_remove +update_db +set_db_def_value +get_db_value +ignore_this_device A11->A12 - - + + A11->A13 - - - - - -A14->A9 - - - - - -A14->A10 - - + + A15 - -Modbus - -que -snd_handler -rsp_handler -timeout -max_retires -last_xxx -err -retry_cnt -req_pend -tim - -build_msg() -recv_req() -recv_resp() -close() + +Message + +node_id + +inc_counter() +dec_counter() + + + +A14->A15 + + - + A15->A9 - - -has -1 + + A15->A10 - - -has -1 + + + + + +A16 + +Modbus + +que +snd_handler +rsp_handler +timeout +max_retires +last_xxx +err +retry_cnt +req_pend +tim + +build_msg() +recv_req() +recv_resp() +close() + + + +A16->A9 + + +has +1 + + + +A16->A10 + + +has +1 diff --git a/app/proxy_2.yuml b/app/proxy_2.yuml index 6a46bae..39a399e 100644 --- a/app/proxy_2.yuml +++ b/app/proxy_2.yuml @@ -3,7 +3,7 @@ // {generate:true} [note: You can stick notes on diagrams too!{bg:cornsilk}] -[IterRegistry||__iter__] +[<>||__iter__()] [InverterG3|addr;remote:StreamPtr;local:StreamPtr|create_remote();;close()] [InverterG3P|addr;remote:StreamPtr;local:StreamPtr|create_remote();;close()] @@ -40,7 +40,9 @@ [SolarmanV5]use->[<>] [SolarmanV5]->[InfosG3P] -[IterRegistry]^[Message|node_id|inc_counter();dec_counter()] +[<>|_registry|close()] +[<>]^-.-[<>] +[<>]^-.-[Message|node_id|inc_counter();dec_counter()] [Message]^[Talent] [Message]^[SolarmanV5]