Added exeption for all reading
This commit is contained in:
parent
fbe885b92c
commit
289afca88d
|
|
@ -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(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue