Added exeption for all reading

This commit is contained in:
Simon 2023-03-20 08:58:39 +01:00
parent fbe885b92c
commit 289afca88d
1 changed files with 36 additions and 36 deletions

View File

@ -41,10 +41,6 @@ async def main():
status = await inverter_client.get( status = await inverter_client.get(
ReadRegister.inverter_reg_status, slave_id ReadRegister.inverter_reg_status, slave_id
) )
except ReadException as error:
LOGGER.error(f"Can't read register, {ReadRegister.inverter_reg_status}. "
f"Error code: {error}. Sleep for 10 min")
await asyncio.sleep(10*60) # Sleep 5 min
LOGGER.info(f"-- INVERTER -- Status: {status}") LOGGER.info(f"-- INVERTER -- Status: {status}")
@ -87,6 +83,10 @@ async def main():
LOGGER.info(f"Sleeping {REQUEST_INTERVAL}") LOGGER.info(f"Sleeping {REQUEST_INTERVAL}")
await asyncio.sleep(REQUEST_INTERVAL) await asyncio.sleep(REQUEST_INTERVAL)
except ReadException as error:
LOGGER.error(f"Can't read register, {ReadRegister.inverter_reg_status}. "
f"Error code: {error}. Sleep for 10 min")
await asyncio.sleep(60) # Sleep 1 min
def send_data( def send_data(