From 6f35c47254a2e4ba90abc737e9c05e766583a0f0 Mon Sep 17 00:00:00 2001 From: Stefan Allius <122395479+s-allius@users.noreply.github.com> Date: Mon, 15 Jul 2024 21:45:45 +0200 Subject: [PATCH] S allius/issue125 (#127) * fix linter warning * move sequence diagramm to wiki * catch asyncio.CancelledError --- README.md | 1 + app/src/mqtt.py | 3 ++- app/tests/timestamp_old.svg | 2 -- app/tests/timestamp_old.yuml | 26 -------------------------- 4 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 app/tests/timestamp_old.svg delete mode 100644 app/tests/timestamp_old.yuml diff --git a/README.md b/README.md index 792c546..3b99825 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,7 @@ If access to the web interface does not work, it can also be redirected via DNS Newer GEN3PLUS inverters support SSL encrypted connections over port 10443 to the TSUN cloud. In this case you can't loop the proxy into this connection, since the certicate verification of the inverter don't allow this. You can configure the proxy in client-mode to establish an unencrypted connection to the inverter. For this porpuse the inverter listen on port `8899`. There are some requirements to be met: + - the inverter should have a fixed IP - the proxy must be able to reach the inverter. You must configure a corresponding route in your router if the inverter and the proxy are in different IP networks - add a 'client_mode' line to your config.toml file, to specify the inverter's ip address diff --git a/app/src/mqtt.py b/app/src/mqtt.py index 25f9408..1ebbd10 100644 --- a/app/src/mqtt.py +++ b/app/src/mqtt.py @@ -38,7 +38,8 @@ class Mqtt(metaclass=Singleton): self.task.cancel() try: await self.task - except Exception as e: + + except (asyncio.CancelledError, Exception) as e: logging.debug(f"Mqtt.close: exception: {e} ...") async def publish(self, topic: str, payload: str | bytes | bytearray diff --git a/app/tests/timestamp_old.svg b/app/tests/timestamp_old.svg deleted file mode 100644 index 739a420..0000000 --- a/app/tests/timestamp_old.svg +++ /dev/null @@ -1,2 +0,0 @@ - -InverterInverterProxyProxyCloudCloudMQTT-BrokerMQTT-BrokerContactIndstore Contact Infoin proxyContactRsp (Ok)getTimeReqContactIndContactRsp (Ok)getTimeReqTimeRsp (time)TimeRsp (time)set clock ininverterDataInd (ts:=time)DataRspDataInd (ts)DataIndDataRspDataInd (ts:=time)DataRspDataInd (ts)DataIndDataRsp \ No newline at end of file diff --git a/app/tests/timestamp_old.yuml b/app/tests/timestamp_old.yuml deleted file mode 100644 index 8f2e99c..0000000 --- a/app/tests/timestamp_old.yuml +++ /dev/null @@ -1,26 +0,0 @@ -// {type:sequence} -// {generate:true} - -[Inverter]ContactInd>[Proxy] -[Proxy]-[note: store Contact Info in proxy{bg:cornsilk}] -[Proxy]ContactRsp (Ok).>[Inverter] - -[Inverter]getTimeReq>[Proxy] -[Proxy]ContactInd>[Cloud] -[Cloud]ContactRsp (Ok).>[Proxy] -[Proxy]getTimeReq>[Cloud] -[Cloud]TimeRsp (time).>[Proxy] -[Proxy]TimeRsp (time).>[Inverter] -[Inverter]-[note: set clock in inverter{bg:cornsilk}] - -[Inverter]DataInd (ts:=time)>[Proxy] -[Proxy]DataRsp>[Inverter] -[Proxy]DataInd (ts)>>[Cloud] -[Proxy]DataInd>>[MQTT-Broker] -[Cloud]DataRsp>>[Proxy] - -[Inverter]DataInd (ts:=time)>[Proxy] -[Proxy]DataRsp>[Inverter] -[Proxy]DataInd (ts)>>[Cloud] -[Proxy]DataInd>>[MQTT-Broker] -[Cloud]DataRsp>>[Proxy]