ShellRechargeSolutionsEU / docile-charge-point

Scriptable OCPP charge point simulator and test tool
GNU General Public License v3.0
82 stars 32 forks source link

OCPP commands backend(CentralSystem) to chargepoint #23

Open RevenMyst opened 3 years ago

RevenMyst commented 3 years ago

I want to develop a backend with a GUI that shows the current state of the chargepoint. I'm able to get info from incoming messages from the chargepoint however I'm not able to send message from my backed to the chargepoint. More precisely, I'm able to send the commands to the chargepoint : If I send

[2,"0","TriggerMessage",{"requestedMessage":"Heartbeat"}]

The interactive command tool print :

meter14:31:56.486 [scala-execution-context-global-22] INFO | <<= - TriggerMessageReq(Heartbeat)

However it does nothing more : it doesn't accept nor refuse and definitively does not send a heartbeat. I tried writing in the command line

TriggerMessageRes(TriggerMessageStatus.Accepted)

But it doesn't seem to be of any help.

Thank you !

reinierl commented 3 years ago

You'd have to expect the incoming message and specify the TriggerMessageRes as the response to it:

expectIncoming(triggerMessageReq.respondingWith(TriggerMessageRes(TriggerMessageStatus.Accepted)))

(typing off the top of my head in the Github comment field, there may be errors).

RevenMyst commented 3 years ago

I tried this but it does not seem to work :

cmd1.sc:1: not found: value triggerMessageReq
val res1 = expectIncoming(triggerMessageReq.respondingWith(TriggerMessageRes(TriggerMessageStatus.Accepted)))
                          ^
Compilation Failed

I looked throught the code and found this in the file core/.../dsl/expectation/Ops.scala :

  def getConfigurationReq = requestMatching { case r: GetConfigurationReq => r }
  def changeConfigurationReq = requestMatching { case r: ChangeConfigurationReq => r }
  def getDiagnosticsReq = requestMatching { case r: GetDiagnosticsReq => r }
  def changeAvailabilityReq = requestMatching { case r: ChangeAvailabilityReq => r }
  def getLocalListVersionReq = requestMatching { case r if r == GetLocalListVersionReq => r }
  def sendLocalListReq = requestMatching { case r: SendLocalListReq => r }
  def clearCacheReq = requestMatching { case r if r == ClearCacheReq => r }
  def resetReq = requestMatching { case r: ResetReq => r }
  def updateFirmwareReq = requestMatching { case r: UpdateFirmwareReq => r }
  def remoteStartTransactionReq = requestMatching { case r: RemoteStartTransactionReq => r }
  def remoteStopTransactionReq = requestMatching { case r: RemoteStopTransactionReq => r }
  def reserveNowReq = requestMatching { case r: ReserveNowReq => r }
  def cancelReservationReq = requestMatching { case r: CancelReservationReq => r }
  def unlockConnectorReq = requestMatching { case r: UnlockConnectorReq => r }

I don't really know scala but it seems to me that it's the file where de behavior of the request that can be sent from the CentralSystem is defined. And I don't see TriggerMessage. Am I right ?

reinierl commented 2 years ago

Yes you're right. You can add it just like the other ones.