git push
This commit is contained in:
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [unreleased]
|
## [unreleased]
|
||||||
|
|
||||||
|
## [0.11.0] - 2024-10-13
|
||||||
|
|
||||||
|
- fix healthcheck on infrastructure with IPv6 support [#196](https://github.com/s-allius/tsun-gen3-proxy/issues/196)
|
||||||
- refactoring: cleaner architecture, increase test coverage
|
- refactoring: cleaner architecture, increase test coverage
|
||||||
- Parse more values in Server Mode [#186](https://github.com/s-allius/tsun-gen3-proxy/issues/186)
|
- 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)
|
- GEN3: add support for new messages of version 3 firmwares [#182](https://github.com/s-allius/tsun-gen3-proxy/issues/182)
|
||||||
|
|||||||
@@ -306,10 +306,6 @@ class AsyncStream(AsyncIfcImpl):
|
|||||||
f"Fwd Exception for {self.r_addr}:\n"
|
f"Fwd Exception for {self.r_addr}:\n"
|
||||||
f"{traceback.format_exc()}")
|
f"{traceback.format_exc()}")
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
logger.info(
|
|
||||||
f"AsyncStream.__del__ l{self.l_addr} | r{self.r_addr}")
|
|
||||||
|
|
||||||
|
|
||||||
class AsyncStreamServer(AsyncStream):
|
class AsyncStreamServer(AsyncStream):
|
||||||
def __init__(self, reader: StreamReader, writer: StreamWriter,
|
def __init__(self, reader: StreamReader, writer: StreamWriter,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from asyncio import StreamReader, StreamWriter
|
from asyncio import StreamReader, StreamWriter
|
||||||
|
|
||||||
if __name__ == "app.src.gen3.inverter_g3":
|
if __name__ == "app.src.gen3.inverter_g3":
|
||||||
from app.src.inverter_base import InverterBase
|
from app.src.inverter_base import InverterBase
|
||||||
from app.src.gen3.talent import Talent
|
from app.src.gen3.talent import Talent
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import asyncio
|
|||||||
import logging
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
import json
|
import json
|
||||||
|
import gc
|
||||||
from aiomqtt import MqttCodeError
|
from aiomqtt import MqttCodeError
|
||||||
from asyncio import StreamReader, StreamWriter
|
from asyncio import StreamReader, StreamWriter
|
||||||
|
|
||||||
@@ -59,8 +60,10 @@ class InverterBase(InverterIfc, Proxy):
|
|||||||
self.local.ifc.close()
|
self.local.ifc.close()
|
||||||
self.local.ifc = None
|
self.local.ifc = None
|
||||||
|
|
||||||
def __del__(self) -> None:
|
# now explicitly call garbage collector to release unreachable objects
|
||||||
logging.debug(f'InverterBase.__del__() {self.addr}')
|
unreachable_obj = gc.collect()
|
||||||
|
logging.debug(
|
||||||
|
f'InverterBase.__exit: freed unreachable obj: {unreachable_obj}')
|
||||||
|
|
||||||
def __del_remote(self):
|
def __del_remote(self):
|
||||||
if self.remote.stream:
|
if self.remote.stream:
|
||||||
|
|||||||
@@ -117,10 +117,6 @@ class Modbus():
|
|||||||
while not self.que.empty():
|
while not self.que.empty():
|
||||||
self.que.get_nowait()
|
self.que.get_nowait()
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
"""log statistics on the deleting of a MODBUS instance"""
|
|
||||||
logging.debug(f'Modbus __del__:\n {self.counter}')
|
|
||||||
|
|
||||||
def build_msg(self, addr: int, func: int, reg: int, val: int,
|
def build_msg(self, addr: int, func: int, reg: int, val: int,
|
||||||
log_lvl=logging.DEBUG) -> None:
|
log_lvl=logging.DEBUG) -> None:
|
||||||
"""Build MODBUS RTU request frame and add it to the tx queue
|
"""Build MODBUS RTU request frame and add it to the tx queue
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class ModbusTcp():
|
|||||||
f'{stream.shutdown_started}')
|
f'{stream.shutdown_started}')
|
||||||
if stream.shutdown_started:
|
if stream.shutdown_started:
|
||||||
return
|
return
|
||||||
|
del inverter # decrease ref counter after the with block
|
||||||
|
|
||||||
except (ConnectionRefusedError, TimeoutError) as error:
|
except (ConnectionRefusedError, TimeoutError) as error:
|
||||||
logging.debug(f'Inv-conn:{error}')
|
logging.debug(f'Inv-conn:{error}')
|
||||||
|
|||||||
@@ -44,9 +44,6 @@ class Mqtt(metaclass=Singleton):
|
|||||||
def ha_restarts(self, value):
|
def ha_restarts(self, value):
|
||||||
self._ha_restarts = value
|
self._ha_restarts = value
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
logger_mqtt.debug('MQTT: __del__')
|
|
||||||
|
|
||||||
async def close(self) -> None:
|
async def close(self) -> None:
|
||||||
logger_mqtt.debug('MQTT: close')
|
logger_mqtt.debug('MQTT: close')
|
||||||
self.task.cancel()
|
self.task.cancel()
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from app.src.singleton import Singleton
|
|||||||
from app.src.config import Config
|
from app.src.config import Config
|
||||||
from app.src.infos import Infos
|
from app.src.infos import Infos
|
||||||
from app.src.mqtt import Mqtt
|
from app.src.mqtt import Mqtt
|
||||||
|
from app.src.inverter_base import InverterBase
|
||||||
from app.src.messages import Message, State
|
from app.src.messages import Message, State
|
||||||
from app.src.proxy import Proxy
|
from app.src.proxy import Proxy
|
||||||
from app.src.modbus_tcp import ModbusConn, ModbusTcp
|
from app.src.modbus_tcp import ModbusConn, ModbusTcp
|
||||||
@@ -195,6 +196,10 @@ async def test_modbus_conn(patch_open):
|
|||||||
assert type(stream.ifc._reader) is FakeReader
|
assert type(stream.ifc._reader) is FakeReader
|
||||||
assert type(stream.ifc._writer) is FakeWriter
|
assert type(stream.ifc._writer) is FakeWriter
|
||||||
assert Infos.stat['proxy']['Inverter_Cnt'] == 1
|
assert Infos.stat['proxy']['Inverter_Cnt'] == 1
|
||||||
|
del inverter
|
||||||
|
|
||||||
|
for _ in InverterBase:
|
||||||
|
assert False
|
||||||
|
|
||||||
assert Infos.stat['proxy']['Inverter_Cnt'] == 0
|
assert Infos.stat['proxy']['Inverter_Cnt'] == 0
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ services:
|
|||||||
- ${PROJECT_DIR:-./}tsun-proxy/log:/home/tsun-proxy/log
|
- ${PROJECT_DIR:-./}tsun-proxy/log:/home/tsun-proxy/log
|
||||||
- ${PROJECT_DIR:-./}tsun-proxy/config:/home/tsun-proxy/config
|
- ${PROJECT_DIR:-./}tsun-proxy/config:/home/tsun-proxy/config
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: wget --no-verbose --tries=1 --spider http://localhost:8127/-/healthy || exit 1
|
test: wget --no-verbose --tries=1 --spider http://127.0.0.1:8127/-/healthy || exit 1
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
Reference in New Issue
Block a user