+ logging.info("%s failed", Action.GetBaseReport)
+
+ async def send_command(self, command_name: Action):
+ logging.debug("Sending OCPP command: %s", command_name)
+ match command_name:
+ case Action.ClearCache:
+ await self.send_clear_cache()
+ case Action.GetBaseReport:
+ await self.send_get_base_report()
+ case _:
+ logging.info(f"Not supported command {command_name}")
+
+
+# Function to send OCPP command
+async def send_ocpp_command(cp, command_name, delay=None, period=None):
+ try:
+ if delay:
+ await asyncio.sleep(delay)
+ cp.send_command(command_name)
+ if period:
+ command_timer = RepeatTimer(
+ period,
+ cp.send_command,
+ [command_name],
+ )
+ command_timer.start()
+ except ConnectionClosed:
+ logging.info("ChargePoint %s closed connection", cp.id)
+ ChargePoints.remove(cp)
+ logging.debug("Connected ChargePoint(s): %d", len(ChargePoints))