custom-components / zaptec

zaptec charger custom component for home assistant
MIT License
67 stars 20 forks source link

Dynamic balancing of a larger Zaptec installation (multiple Zaptec Pro chargers) #12

Closed netforceatg closed 1 year ago

netforceatg commented 3 years ago

Hello,

Thanks for this HomeAssistant component.

I live in a lager community with many Zapchargers. The Zaptec portal have support to change the maximum allowed current for the installation (all chargers combined). However it would be very nice feature to adjust this through HomeAssistant and we could then use load balancing \ steer the Zaptec system, based on the overall load of the main fuse(as our HomeAssistant can read the AMS meter realtime).

Zaptec supports setting the maximum powerconsumption through their API, more info here(last page): https://zaptec.com/downloads/ZapChargerPro_Integration.pdf

I belive these settings are available through their API: https://api.zaptec.com/help/index#!/Installation/Installation_GetAll

Under: "AvailableCurrent": 0, "AvailableCurrentPhase1": 0, "AvailableCurrentPhase2": 0, "AvailableCurrentPhase3": 0,

Can this be added to this intigration? This would be an awesome feature

Hellowlol commented 3 years ago

I have already added support for this in the api.py file, i just need to clean it up and add a servicecall to home assistant. I have only tested this with zaptec home, does it work for pro too?

netforceatg commented 3 years ago

Sounds promising.

I think it does, the links to the API i fowarded was for the ZapChargerPro intigration, so if the API calls are the same I home it works.

I can test it out in a months time.

I have a project with the community(sameiet) where I live in to have a look at if we can increase the power draw of the Zaptec installation. I'm trying to avoid to increase the main fuse infront of the Zaptec system(its also shared with a few public spaces in th building). So with loadbalancing allowed power consumtion on the Zaptec installation, depending on how much power the public areas in the building use will be fantastic.

I know businesses out there have their own solutions (Like Lyse Smartly, and Zaptec APM(adaptive power management - plugs into the HAN port of the AMS kWh meter and adjust the Zaptec installation). But these usually carries a montly fee which becomes rather high over time.

netforceatg commented 3 years ago

How is this progressing? Anything I can do to help?

I've connected and set up a home assistent to the Sameiet Zaptec system, so let me know if you want me to test the code.

Hellowlol commented 3 years ago

I havnt done anything. Does the component work on your install? I can add a service call. It should be a quick fix

Eugy-HA commented 3 years ago

Any news on shared garage install of zaptec, will there be possibilities to integrate with HA? I can share my accsess if nessesary.

Hellowlol commented 2 years ago

@Eugy-HA I have created a script that uses signal r to communicate with the backend. But I don't have a charger that i can test with. (I have easee) i do have access to a Zaptec home charger with admin rights, but i'm not sure if that would be the same.

What kind of access right do you have on the charger and the install?

Hellowlol commented 2 years ago

@netforceatg Does the component work for you? Do you only need a service call for setting the power?

kolibri15 commented 2 years ago

Hi Steffen thanks very much for your code - every thing works fine - only the described setting the power in the Zaptec charger is missing

means following data "AvailableCurrent": 0, "AvailableCurrentPhase1":xx, "AvailableCurrentPhase2": xx "AvailableCurrentPhase3": xx

I can not send the datas out of HA to the api.zaptec.com plattform .

I tried to post the data with curl command found on

https://api.zaptec.com/help/index.html#/Charger/post_api_chargers__id__sendCommand__commandId_

The curl-api command works from the terminal of the pc and from the terminal of HA. ( with proper token an admin rights on Zaptec charger settings etc.)

In HA I tried to execute the curl-api command with a "shell_command:" (yaml) but no success.

For your info : I work although with the Zaptec home charcher Thank you very much for a short answer or hint

Hellowlol commented 2 years ago

@kolibri15 I haven't added a service call for it so it isn’t possible to use this component to do that yet.

gustafssone commented 2 years ago

@Hellowlol I tried adding a service call, but cannot figure out how to pass the phases. I'm not familar at all with python so it is all guesswork, just a beginner. I got stuck at: https://github.com/gustafssone/zaptec/blob/main/custom_components/zaptec/services.yaml (guessing it is ok) https://github.com/gustafssone/zaptec/blob/3b4e73a5f29cbd1473b638e0af3021db11789bcf/custom_components/zaptec/services.py#L65 (how to map the phases) https://github.com/gustafssone/zaptec/blob/3b4e73a5f29cbd1473b638e0af3021db11789bcf/custom_components/zaptec/api.py#L606 (issuing the command and receiving the phases) I could see that there is a bunch of code at https://github.com/gustafssone/zaptec/blob/3b4e73a5f29cbd1473b638e0af3021db11789bcf/custom_components/zaptec/api.py#L168 but not sure how to use it.

Let me know if I am on the right track. I have a Zaptec Go with 3 phase loadbalancing. From what I can see, one cannot send both single phase and 3 phases simultaneously, "Provide either AvailableCurrent or AvailableCurrentPhase1, AvailableCurrentPhase2 and AvailableCurrentPhase3." https://api.zaptec.com/help/index.html#/Installation/post_api_installation__id__update .

Hellowlol commented 2 years ago

I mentioned you only need to add service call.

https://github.com/custom-components/zaptec/blob/master/custom_components/zaptec/api.py#L168-L191

Inside the service_call get the Installasjon object. call the limit_amps with keyword arguments from the service call data. limit_amps(AvailableCurrent=10) or whatever Register the service. Add the service call to services.yaml

Next time just recreate a pr, its much easier to review it :) Thanks for getting involved! :D

gustafssone commented 2 years ago

Perhaps like this? https://github.com/custom-components/zaptec/pull/23

romhug commented 1 year ago

Is this new feature (load balancing) already available in a release? I have 0.0.5 running on my HA (HACS) but i don't see any Phase informations. How can I use this new feature on HA?

gustafssone commented 1 year ago

Still haven't got around to testing/verifying a fix, but still intends to do so.

romhug commented 1 year ago

Thank you very much. Just let me know if I can assist you with testing. I have a Zaptec go wallbox in use.

gordonrouse commented 1 year ago

Also happy to help with testing - Have a Zaptec home and Home Assistant using the component.

sveinse commented 1 year ago

The official way to set the charge current is the "Available Current" setting (or "Available Current Phase 1|2|3" for 3 phase) on the installation object. This will affect all chargers that is connected to the installation, making it unfit for multi charger setups. Each charger has settings named "Charger min current" and "Charger max current". Adjusting them seems to be what's needed to control charge current in such setups.

It might be useful to know that I'm working on a significant improvement to zaptec, which supports setting these charge currents. It is tracked in PR #56 which will be released once its stable. It is at beta test in my fork at https://github.com/sveinse/zaptec and is installable via HACS (yet I'd be careful on production environments). See the URL for instructions if you want to give it a go. I'm grateful for all feedback I can get.

blarrkan commented 1 year ago

Sorry if this comment lads in wrong section. But as its talk about dynamic balancing. Does anyone have a working load balancing setup using this plugin or sveinse? I´m just starting to use this and sveinse is working great, I just need to figure out a good way to build the load balancing. Currently I´m trying to build something up in node-red.

sveinse commented 1 year ago

I'm closing this issue. In the newest 0.7.0 beta, it is possible to control the charge current from HA, either all phases or individual three phase. It is not within scope for the integration to make a scheme for dynamic balancing. I'm a bit uncertain how aggressive this dynamic balancing can be, as Zaptec's own docs sais that the current settings for the installation shouldn't change more often than once each 15 minutes. In all cases, everything is ready to implement a custom load balancing system in HA.

(And thus, unfortunately @blarrkan I don't have any system setup for that.)