split AsyncStream in two classes

This commit is contained in:
Stefan Allius
2024-09-26 23:04:11 +02:00
parent b6761e7517
commit 73526b7dc6
10 changed files with 620 additions and 505 deletions

View File

@@ -74,7 +74,7 @@ class InverterG3P(Inverter, ConnectionG3P):
logging.info(f'[{self.remote.stream.node_id}:'
f'{self.remote.stream.conn_no}] '
f'Connected to {addr}')
asyncio.create_task(self._ifc.client_loop(addr))
asyncio.create_task(self.remote.ifc.client_loop(addr))
except (ConnectionRefusedError, TimeoutError) as error:
logging.info(f'{error}')
@@ -86,6 +86,9 @@ class InverterG3P(Inverter, ConnectionG3P):
async def async_publ_mqtt(self) -> None:
'''publish data to MQTT broker'''
if not self.unique_id:
return
# check if new inverter or collector infos are available or when the
# home assistant has changed the status back to online
try:
@@ -100,7 +103,7 @@ class InverterG3P(Inverter, ConnectionG3P):
for key in self.new_data:
await self.__async_publ_mqtt_packet(key)
for key in Infos.new_stat_data:
await self._async_publ_mqtt_proxy_stat(key)
await Inverter._async_publ_mqtt_proxy_stat(key)
except MqttCodeError as error:
logging.error(f'Mqtt except: {error}')