Skip to content

Commit

Permalink
+ OCPP-J support error code in status payload
Browse files Browse the repository at this point in the history
  • Loading branch information
aghajani committed Jul 14, 2020
1 parent 09ac061 commit 6f738dd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions device/ocpp_j/device_ocpp_j.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,14 @@ async def action_heart_beat(self) -> bool:
return True

async def action_status_update(self, status, **options) -> bool:
return await self.action_status_update_ocpp(status, "NoError", **options)

async def action_status_update_ocpp(self, status, errorCode, **options) -> bool:
action = "StatusNotification"
self.logger.info(f"Action {action} Start")
json_payload = {
"connectorId": options.pop("connectorId", 1),
"errorCode": "NoError",
"errorCode": errorCode,
"status": status
}
if await self.by_device_req_send(action, json_payload) is None:
Expand Down Expand Up @@ -398,5 +401,6 @@ async def loop_interactive_custom(self):
await self.action_heart_beat()
elif input1 == "2":
input1 = await aioconsole.ainput("Which status?\n")
await self.action_status_update(input1)
input2 = await aioconsole.ainput("Which errorCode?\n")
await self.action_status_update_ocpp(input1, input2)
pass

0 comments on commit 6f738dd

Please sign in to comment.