ocpp icon indicating copy to clipboard operation
ocpp copied to clipboard

Support more than one charge point

Open munterkalmsteiner opened this issue 1 year ago • 6 comments

Addresses #1053.

This is a draft. Tests and updated documentation missing.

munterkalmsteiner avatar Jan 21 '24 14:01 munterkalmsteiner

hi @munterkalmsteiner, I started adding functionality for multiple charge points a few months ago already, but was never able to finish it due to lack of time. You can find my code in the new_option_flows branch. My approach was to allow the user to create three different types of entities: Central System, Charge Point, and Tag. The properties could also be edited after creation, using OptionFlows. Maybe you an take a look and salvage what you find useful?

lbbrhzn avatar Jan 28 '24 09:01 lbbrhzn

@lbbrhzn I see! There is definitely something I can peek/reuse from, in particular since I'm new to the project and don't know the code base well. Since this is quite a large change and I would really have it upstream rather than maintaining my own fork, how would you like to proceed? I propose that I have a look at your config flow and rewrite mine (you have implemented alternative 2, described in #1053). I don't know what a tag device is (I just started out with OCPP when I got my car a month ago), so not sure how to handle this. Once the rough implementation is ready, I would appreciate a review before I spend effort on tests and documentation updates. When that draft is acceptable, then I would proceed and update tests and documentation. Timeline is at least a couple of weeks (I prio this on my hobby list before it gets warm outside :) Would that work for you?

munterkalmsteiner avatar Jan 28 '24 18:01 munterkalmsteiner

Your proposal sounds fine to me! I really appreciate your help!

A tag is and RFID card or fob, that get scanned by the charge point. It can be used to start / stop transactions. The integration currently only supports specifying tags in yaml. On my branch I added functionality to allow tags to be added/edited through the home assistant GUI.

My general strategy with the config / option flows was to allow as much parameters as possible to be changed through the option flow. As a result, config flows and options flows are nearly the same.
It would be nice to allow a charge point entities to be automatically created when it connects for the first time. Same could be done for tags. This will save the user some time entering long tag numbers.

lbbrhzn avatar Jan 28 '24 19:01 lbbrhzn

Your proposal sounds fine to me! I really appreciate your help!

Thanks!

A tag is and RFID card or fob, that get scanned by the charge point. It can be used to start / stop transactions. The integration currently only supports specifying tags in yaml. On my branch I added functionality to allow tags to be added/edited through the home assistant GUI.

I see.

My general strategy with the config / option flows was to allow as much parameters as possible to be changed through the option flow. As a result, config flows and options flows are nearly the same.

Ok.

It would be nice to allow a charge point entities to be automatically created when it connects for the first time. Same could be done for tags. This will save the user some time entering long tag numbers.

Hm, I'm not sure I'm following you here. Isn't this already the case for charge points, i.e. a user creates a charge point device and when the charge point connects to the central system, the entities for the charge point are created, based on the configured/detected measurands. Or do you mean the charge point device is created as soon as it connects to the central system?

Since I don't have any tags, I know nothing about how they work in the context of OCPP. How would they be discovered? Is this something that can be queried from the charge point?

munterkalmsteiner avatar Jan 30 '24 21:01 munterkalmsteiner

I don't use tags either but suggest it may be helpful to simply use HA's existing tags rather than have our own option flow for them. https://www.home-assistant.io/blog/2020/09/15/home-assistant-tags/ potentially it would allow authorisation away from the charger by presenting a tag to your mobile (if it supports NFC) for example, and there may be other automation use cases where the charger tag can be used for other purposes in HA.

drc38 avatar Jan 31 '24 19:01 drc38

some tests are still failing...

lbbrhzn avatar Mar 23 '24 09:03 lbbrhzn

What else needs doing before this code can be merged?

sandersr avatar May 14 '24 13:05 sandersr

This PR is abandoned as I'm continuing the work by @lbbrhzn on his feature branch, see here. But it is not finished yet and I don't see to have any time to work on it until the June/July.

munterkalmsteiner avatar May 14 '24 18:05 munterkalmsteiner

closing pull rerquest, since abandonded

lbbrhzn avatar May 16 '24 06:05 lbbrhzn