Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of how to send a message from server to client #19

Open
profnimrod opened this issue Aug 9, 2022 · 5 comments
Open

Example of how to send a message from server to client #19

profnimrod opened this issue Aug 9, 2022 · 5 comments

Comments

@profnimrod
Copy link

Could you please provide an example of how to send a message from the server to a ChargePoint using the library. Say, for example, a SetChargingProfile message. There doesn't seem to be a way via the UI, but it looks like the library supports it.

@billywatsy
Copy link

hi @profnimrod

you can expose what you want to send via API and let the UI call that endpoint , l haven't checked the UI only the server but @dallmann-consulting can advice

but want l think is expose the functionality via API like what was done on the reset , you can post your values as body or query params of the properties you need in the chargeprofile and have a method which formats those to SetChargeProfile

for example check how reset is done
image

calling the endpoint /API/Reset/{chargepointId}
[this is a call on the API and will then send to the chargepoint a reset command if charge is online]

so in this case you can have
calling the endpoint /API/SetChargeProfile/{chargepointId}
and have also another method to handle response

Hope this helps

@dallmann-consulting
Copy link
Owner

Thank you @billywatsy. Absolutely correct :-)

You need to implement the message in the server API. The UI uses the server's API to send a reset or unlock message. The server blocks your call until it receives an answer from the charger and sends you a result. So from an API perspective it seems like a synchronous call.
To set a charging profile with a power limit was not in my focus for the first version. It would make sense with the semi dynamic power management described in issue #21.

@profnimrod
Copy link
Author

Thanks for your comments guys - I'll take a crack at a charge profile message and let you know how I get on.

@profnimrod
Copy link
Author

I've nearly got this working now... I'm afraid I don't have the time to detail my approach (it is based on guidance above), but I have included a link the full updated VS Solution for both the server and management tool in case anyone is interested. At the moment a hard-coded profile is pushed out, so that'll need to change, but on the whole I think it is close to what is needed. At the moment my test charger is rejecting the message, but I suspect I just have a minor bug somewhere.

VS Solution

@profnimrod
Copy link
Author

profnimrod commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants