+ logging.info("%s failed", Action.ClearCache)
+
+ async def send_get_base_report(self):
+ request = ocpp.v201.call.GetBaseReport(
+ reportBase=ReportBaseType.ConfigurationInventory
+ )
+ response = await self.call(request)
+
+ if response.status == ReportBaseType.accepted:
+ logging.info("%s successful", Action.GetBaseReport)
+ else:
+ logging.info("%s filed", Action.GetBaseReport)
+
+
+
+# Function to send OCPP command
+async def send_ocpp_command(cp, command_name, delay=None, period=None):
+ try:
+ match command_name:
+ case Action.ClearCache:
+ logging.info("%s Send:", Action.ClearCache)
+ await cp.send_clear_cache()
+ case Action.GetBaseReport:
+ logging.info("%s Send:", Action.GetBaseReport)
+ await cp.send_get_base_report()
+ except Exception:
+ logging.exception(f"Not supported or Failure while processing command {command_name}")
+
+ if delay:
+ await asyncio.sleep(delay)
+
+ if period:
+ my_timer = RepeatTimer(period, asyncio.create_task, [cp.send_ocpp_command(command_name)])
+ my_timer.start()