ocpp icon indicating copy to clipboard operation
ocpp copied to clipboard

Pass the cp Handler to an after decorator

Open betovaca opened this issue 3 years ago • 0 comments

Hello,

Just like when I send a message from my cp to my server:

async def send_heartbeat(self, cp, interval=3600):
    request = call.HeartbeatPayload()
    while True:
        await cp.call(request)
        await asyncio.sleep(interval)

I send the cp handler to send the message. I would like to do the same thing for an after decorator so it can send messages from the cp handler. Right now I have this:

@after(Action.GetBaseReport)
async def after_get_base_report_request(self, request_id, report_base):
    await send_notify_report_request(report_base=report_base, request_id=request_id)

But my send_notify_report_request is defined as follows : async def send_notify_report_request(self, cp, **kwargs)

How could I manage to send my cp handler for an after decorator?

betovaca avatar Jul 01 '22 08:07 betovaca