diff --git a/Makefile b/Makefile index 24f9ab6..49be846 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build clean addon-dev addon-debug addon-rc addon-rel debug dev preview rc rel +.PHONY: build clean addon-dev addon-debug addon-rc addon-rel debug dev preview rc rel check-docker-compose install debug dev preview rc rel: $(MAKE) -C app $@ @@ -12,3 +12,7 @@ addon-dev addon-debug addon-rc addon-rel: check-docker-compose: docker-compose config -q +install: + python3 -m pip install --upgrade pip + python3 -m pip install -r requirements.txt + python3 -m pip install -r requirements-test.txt \ No newline at end of file diff --git a/app/docu/proxy.svg b/app/docu/proxy.svg index f032452..735ade7 100644 --- a/app/docu/proxy.svg +++ b/app/docu/proxy.svg @@ -4,257 +4,260 @@ - + G - + A0 - - - -You can stick notes -on diagrams too! + + + +You can stick notes +on diagrams too! A1 - -<<AbstractIterMeta>> - - -__iter__() + +<<AbstractIterMeta>> + + +__iter__() A4 - -<<InverterIfc>> - - -healthy()->bool -<async>disc(shutdown_started=False) -<async>create_remote() + +<<InverterIfc>> + + +healthy()->bool +<async>disc(shutdown_started=False) +<async>create_remote() A1->A4 - - + + A2 - -Mqtt -<<Singleton>> - -<static>ha_restarts -<static>__client -<static>__cb_MqttIsUp - -<async>publish() -<async>close() + +Mqtt +<<Singleton>> + +<static>ha_restarts +<static>__client +<static>__cb_MqttIsUp + +<async>publish() +<async>close() A3 - -Proxy - -<cls>db_stat -<cls>entity_prfx -<cls>discovery_prfx -<cls>proxy_node_id -<cls>proxy_unique_id -<cls>mqtt:Mqtt -__ha_restarts - -class_init() -class_close() -<async>_cb_mqtt_is_up() -<async>_register_proxy_stat_home_assistant() -<async>_async_publ_mqtt_proxy_stat(key) + +Proxy + +<cls>db_stat +<cls>entity_prfx +<cls>discovery_prfx +<cls>proxy_node_id +<cls>proxy_unique_id +<cls>mqtt:Mqtt +__ha_restarts + +class_init() +class_close() +<async>_cb_mqtt_is_up() +<async>_register_proxy_stat_home_assistant() +<async>_async_publ_mqtt_proxy_stat(key) A3->A2 - - - + + + A5 - -InverterBase - -_registry -__ha_restarts -addr -config_id:str -prot_class:MessageProt -remote:StreamPtr -local:StreamPtr - -healthy()->bool -<async>disc(shutdown_started=False) -<async>create_remote() -<async>async_publ_mqtt() + +InverterBase + +_registry +__ha_restarts +addr +config_id:str +prot_class:MessageProt +remote:StreamPtr +local:StreamPtr + +healthy()->bool +<async>disc(shutdown_started=False) +<async>create_remote() +<async>async_publ_mqtt() A3->A5 - - + + A4->A5 - - + + A6 - -StreamPtr - - -stream:ProtocolIfc -ifc:AsyncIfc + +StreamPtr + + +stream:ProtocolIfc +ifc:AsyncIfc A5->A6 - - -2 + + +2 A7 - -InverterG3 + +InverterG3 A5->A7 - - + + A9 - -InverterG3P + +InverterG3P A5->A9 - - + + A11 - -<<AsyncIfc>> + +<<AsyncIfc>> A6->A11 - - -1 + + +1 A12 - -<<ProtocolIfc>> + +<<ProtocolIfc>> A6->A12 - - -1 + + +1 A8 - - - -Creates an GEN3 -inverter instance -with -prot_class:Talent + + + +Creates an GEN3 +inverter instance +with +prot_class:Talent A7->A8 - + A10 - - - -Creates an GEN3PLUS -inverter instance -with -prot_class:SolarmanV5 + + + +Creates an GEN3PLUS +inverter instance +with +prot_class:SolarmanV5 A9->A10 - + A12->A11 - - -use + + +use A13 - -ModbusConn - -host -port -addr -stream:InverterG3P - + +ModbusConn + +host +port +addr +stream:InverterG3P + A13->A9 - - -1 -has + + +1 +has A14 - -ModbusTcp + +ModbusTcp + + +<async>modbus_loop() A14->A13 - - -* -creates + + +* +creates diff --git a/app/docu/proxy.yuml b/app/docu/proxy.yuml index dbb5417..71ef970 100644 --- a/app/docu/proxy.yuml +++ b/app/docu/proxy.yuml @@ -32,5 +32,5 @@ [ModbusConn|host;port;addr;stream:InverterG3P;|]has-1>[InverterG3P] -[ModbusTcp]creates-*>[ModbusConn] +[ModbusTcp||modbus_loop()]creates-*>[ModbusConn] diff --git a/app/docu/proxy_3.svg b/app/docu/proxy_3.svg index 37fc587..8be4969 100644 --- a/app/docu/proxy_3.svg +++ b/app/docu/proxy_3.svg @@ -4,11 +4,11 @@ - + G - + A0 @@ -47,78 +47,78 @@ A2 - -InverterG3P - -addr -remote:StreamPtr -local:StreamPtr - -create_remote() -close() + +InverterG3P + +addr +remote:StreamPtr +local:StreamPtr + +create_remote() +close() A3 - -local:StreamPtr + +local:StreamPtr A2->A3 - - - + + + A4 - -remote:StreamPtr + +remote:StreamPtr A2->A4 - - - + + + A8 - -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() A3->A8 - - - + + + A9 - -AsyncStreamClient - - -<async>client_loop() -<async>_async_forward()) + +AsyncStreamClient + + +<async>client_loop() +<async>_async_forward()) A4->A9 - - -0..1 + + +0..1 @@ -149,135 +149,138 @@ A6 - -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 A5->A6 - - + + A7 - -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() A6->A7 - - + + A7->A8 - - + + A7->A9 - - + + A10 - -SolarmanV5 - -conn_no -addr -control -serial -snr -db:InfosG3P -switch - -msg_unknown() -healthy() -close() + +SolarmanV5 + +conn_no +addr +control +serial +snr +db:InfosG3P +switch + +msg_unknown() +healthy() +close() A10->A3 - - - + + + A10->A4 - - -0..1 + + +0..1 A12 - -InfosG3P - - -ha_confs() -parse() + +InfosG3P + +client_mode:bool + +ha_confs() +parse() +calc() +build() A10->A12 - - + + 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 - - + + @@ -321,8 +324,8 @@ A13->A10 - - + + diff --git a/app/docu/proxy_3.yuml b/app/docu/proxy_3.yuml index 499c93f..3703658 100644 --- a/app/docu/proxy_3.yuml +++ b/app/docu/proxy_3.yuml @@ -26,7 +26,7 @@ [remote:StreamPtr]0..1->[AsyncStreamClient] [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]^[InfosG3P||ha_confs();parse()] +[Infos]^[InfosG3P|client_mode:bool|ha_confs();parse();calc();build()] [SolarmanV5]->[InfosG3P] diff --git a/app/requirements-test.txt b/app/requirements-test.txt index a26074c..07b0cf9 100644 --- a/app/requirements-test.txt +++ b/app/requirements-test.txt @@ -1,8 +1,8 @@ - flake8 - pytest - pytest-asyncio - pytest-cov - python-dotenv - mock - coverage - jinja2-cli \ No newline at end of file + flake8==7.1.2 + pytest==8.3.5 + pytest-asyncio==0.25.3 + pytest-cov==6.0.0 + python-dotenv==1.0.1 + mock==5.2.0 + coverage==7.7.1 + jinja2-cli==0.8.2 \ No newline at end of file