- async def send_command_repeatedly():
- while True:
- command_name = await charge_point.receive_command()
- try:
- match command_name:
- case Action.ClearCache:
- logging.info("ClearCache parser working")
- await charge_point.send_clear_cache()
- case Action.GetBaseReport:
- logging.info("GetBaseReport parser working")
- await charge_point.send_get_base_report()
- case _:
- logging.warning(f"Unsupported command {command_name}")
- except Exception as e:
- logging.exception(f"Failure while processing command {command_name}")
- finally:
- await asyncio.sleep(period)
-
- timer = RepeatTimer(period, send_command_repeatedly)
- await timer.start()
- await timer.wait_closed() # Wait for timer to finish before exiting
-
- else:
- if command_name == "GetBaseReport":
- await cp.send_get_base_report()