Skip to content

Commit

Permalink
feat: add optional param for passing an unique_id to call method.
Browse files Browse the repository at this point in the history
  • Loading branch information
santiagosalamandri committed Apr 13, 2023
1 parent e6ed033 commit 081ffae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ocpp/charge_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ async def _handle_call(self, msg):
# when no '_on_after' hook is installed.
pass

async def call(self, payload, suppress=True):
async def call(self, payload, suppress=True, unique_id=None):
"""
Send Call message to client and return payload of response.
Expand All @@ -261,8 +261,12 @@ async def call(self, payload, suppress=True):
"""
camel_case_payload = snake_to_camel_case(asdict(payload))

unique_id = (
unique_id if unique_id is not None else str(self._unique_id_generator())
)

call = Call(
unique_id=str(self._unique_id_generator()),
unique_id=unique_id,
action=payload.__class__.__name__[:-7],
payload=remove_nones(camel_case_payload),
)
Expand Down

0 comments on commit 081ffae

Please sign in to comment.