cliviu74 / wallbox

Python Module interface for Wallbox EV chargers api
Apache License 2.0
60 stars 21 forks source link

New feature addition request (code attached) #32

Closed rubenms73 closed 3 months ago

rubenms73 commented 9 months ago

Hi, Wallbox has just introduced a new feature in newer firmwares. You can now modify the maximum power available in the installation (Powerboost feature) using the cloud. After a few tries I came up with this method:

def setIcpMaxCurrent(self, chargerId, newIcpMaxCurrentValue):    
    try:
        response = requests.post(
            f"{self.baseUrl}chargers/config/{chargerId}",
            headers=self.headers,
            json={'icp_max_current': newIcpMaxCurrentValue},
        )
        response.raise_for_status()
    except requests.exceptions.HTTPError as err:
        raise (err)
    return json.loads(response.text)  

I have succesfully tried it on my Wallbox Pulsar Max (latest firmware 6.1.13). I hope you consider it a good addition to your useful development.

cliviu74 commented 7 months ago

Hey @rubenms73, thanks for requesting this feature. As far as I can see, the PowerBoost feature depends on an EMS being installed. More so, Wallbox requires bluetooth access for enabling this in the app. https://support.wallbox.com/en/knowledge-base/how-to-activate-power-boost/

The intention of this library is to be a lightweight python interface to Wallbox api, for use with home automation systems, like Home Assistant. I think your feature request goes out of the intended scope and it may lead to unexpected behaviours if used with chargers that don't have an EMS.

Having said that, I'd be interested to hear your use case. Can you tell me a bit more on how would you use that on daily basis?

rubenms73 commented 7 months ago

Hi, I’m using this in Spain and the power available in my charger differs depending on the time of the day, weekends and bank holidays. Specifically I’ve got 20 A (4,6 Kw) from 08:00 till 23:59 and 25 A (5,7 kW) from 00:00 till 07:59, Saturdays, Sundays and national bank holidays.

With this in mind I’ve programmed a script that changes both the output power and the ICP value to match the available power in the installation automatically. That ICP value (power boost feature) can now be changed from the cloud, as opposed to the previous situation where it could only be changed by bluetooth.

In summary, right now I’m able to adjust the output power and the maximum power available in the installation dynamically, to properly match the specifics of my contract.

Best regards Rubén Muñiz

On 8 Feb 2024, at 14:21, cliviu74 @.***> wrote:

No suele recibir correos electrónicos de @.*** Por qué esto es importantehttps://aka.ms/LearnAboutSenderIdentification

Hey @rubenms73https://urldefense.com/v3/__https://github.com/rubenms73__;!!D9dNQwwGXtA!Tt65ktLHG-jXWOsLSC0cBIZziLQJ-VW4VmdGIovCNrvZFdBEwRsCbw3VcTHqGMiZ1UF9TbwbpFK1UuQhtyHVIsek$, thanks for requesting this feature. As far as I can see, the PowerBoost feature depends on an EMS being installed. More so, Wallbox requires bluetooth access for enabling this in the app. https://support.wallbox.com/en/knowledge-base/how-to-activate-power-boost/https://urldefense.com/v3/__https://support.wallbox.com/en/knowledge-base/how-to-activate-power-boost/__;!!D9dNQwwGXtA!Tt65ktLHG-jXWOsLSC0cBIZziLQJ-VW4VmdGIovCNrvZFdBEwRsCbw3VcTHqGMiZ1UF9TbwbpFK1UuQhtx51wVYQ$

The intention of this library is to be a lightweight python interface to Wallbox api, for use with home automation systems, like Home Assistant. I think your feature request goes out of the intended scope and it may lead to unexpected behaviours if used with chargers that don't have an EMS.

Having said that, I'd be interested to hear your use case. Can you tell me a bit more on how would you use that on daily basis?

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/cliviu74/wallbox/issues/32*issuecomment-1934114011__;Iw!!D9dNQwwGXtA!Tt65ktLHG-jXWOsLSC0cBIZziLQJ-VW4VmdGIovCNrvZFdBEwRsCbw3VcTHqGMiZ1UF9TbwbpFK1UuQht4yxaGlS$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AXBOEVMNAHMDNWEN5RDBHLLYSTGNHAVCNFSM6AAAAABAVMXQYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZUGEYTIMBRGE__;!!D9dNQwwGXtA!Tt65ktLHG-jXWOsLSC0cBIZziLQJ-VW4VmdGIovCNrvZFdBEwRsCbw3VcTHqGMiZ1UF9TbwbpFK1UuQht8Anys_n$. You are receiving this because you were mentioned.Message ID: @.***>

sincze commented 7 months ago

@rubenms73

Sounds a bit like... my usecase.

I use it to fluctuate charging power on the the solar production. (lot's of solar power... increase.... decrease of solar power ... decrease) Why... because I don't have a 3-phase inverter (that is needed by default to have this work out of the box with Wallbox software).

image

cliviu74 commented 7 months ago

Would setMaxChargingCurrent(chargerId, chargingCurrentValue) not be suitable for your usecase? @sincze @rubenms73 This should allow you to limit your charging current on demand.

rubenms73 commented 7 months ago

Not really as it doesn’t affect the maximum power available in the installation, therefore the energy meter won’t work to prevent the energy to be cut by the power meter. Example:

Let’s say that I’ve got two different limits: 20 and 25 A. If I set the maximum power of the installation as 25 A, if I try to use the charger in the period in which the limit is 20 A, even though if I limit the power output to 20 A, the charger is going to believe that there is an addition 5 A, i.e.: max_power – output_power = 25 -20 = 5 A.

In that situation, if the consumption of the house + the consumption of the charger is above 20 A, the Wallbox is going to allow it as it sits below 25 A (the maximum power available), therefore the power meter will shut the whole system off. That’s why it’s important that the value of the maximum power setting matches the one defined in the power meter (20 or 25 in my example), to allow the powerboost feature to work seamlessly by adjusting the output power dynamically depending of the power needs of the rest of the house.

De: cliviu74 @.> Enviado el: jueves, 8 de febrero de 2024 16:41 Para: cliviu74/wallbox @.> CC: RUBEN MUÑIZ SANCHEZ @.>; Mention @.> Asunto: Re: [cliviu74/wallbox] New feature addition request (code attached) (Issue #32)

No suele recibir correos electrónicos de @.**@.>. Por qué esto es importantehttps://aka.ms/LearnAboutSenderIdentification

Would setMaxChargingCurrent(chargerId, chargingCurrentValue) not be suitable for your usecase? @sinczehttps://urldefense.com/v3/__https:/github.com/sincze__;!!D9dNQwwGXtA!Uqw0tN59gNgsEeHV8dtRJ0nlzQ9QuTj6bBfGbPPH2Bz7mL3mEeLG-QyCLVioSfoW7qaXd9XeGWhmCccfTqSwLXqI$ @rubenms73https://urldefense.com/v3/__https:/github.com/rubenms73__;!!D9dNQwwGXtA!Uqw0tN59gNgsEeHV8dtRJ0nlzQ9QuTj6bBfGbPPH2Bz7mL3mEeLG-QyCLVioSfoW7qaXd9XeGWhmCccfTogItts5$ This should allow you to limit your charging current on demand.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/cliviu74/wallbox/issues/32*issuecomment-1934396016__;Iw!!D9dNQwwGXtA!Uqw0tN59gNgsEeHV8dtRJ0nlzQ9QuTj6bBfGbPPH2Bz7mL3mEeLG-QyCLVioSfoW7qaXd9XeGWhmCccfTnTzPF7-$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AXBOEVN6EC5BBBSKIUGAXTTYSTWYHAVCNFSM6AAAAABAVMXQYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZUGM4TMMBRGY__;!!D9dNQwwGXtA!Uqw0tN59gNgsEeHV8dtRJ0nlzQ9QuTj6bBfGbPPH2Bz7mL3mEeLG-QyCLVioSfoW7qaXd9XeGWhmCccfTgIjD0HR$. You are receiving this because you were mentioned.Message ID: @.**@.>>

sincze commented 7 months ago

Aha i think I get the picture here.

So the dynamic Loadbalancing does not work appropriately without implementing your request for that use-case? Honestly I thought it would and should as illustrated with @cliviu74 his example.

rubenms73 commented 7 months ago

Yep, that’s what I think. To be honest I haven’t tried it since I’ve always done things “by the book”.

That ICP setting Wallbox refers to comes from “Interruptor de Control de Potencia” in Spanish, which translates as “Power Control Switch”. It’s an internal breaker that comes in every modern power meter being installed in Spain. Years ago it was another breaker in the fuse box, connected directly to the main line from the meter. Whenever we exceeded the max power defined in the contract, we had to reset that breaker manually.

In summary, in Spain it’s possible to contract two different power values for peak and night hours (different price), therefore it makes sense to get more power for the night, when the car will be usually charged.

De: Sandor @.> Enviado el: jueves, 8 de febrero de 2024 16:59 Para: cliviu74/wallbox @.> CC: RUBEN MUÑIZ SANCHEZ @.>; Mention @.> Asunto: Re: [cliviu74/wallbox] New feature addition request (code attached) (Issue #32)

No suele recibir correos electrónicos de @.**@.>. Por qué esto es importantehttps://aka.ms/LearnAboutSenderIdentification

Aha i think I get the picture here.

So the dynamic Loadbalancing does not work appropriately without implementing your request for that use-case? Honestly I thought it would and should as illustrated with @cliviu74https://urldefense.com/v3/__https:/github.com/cliviu74__;!!D9dNQwwGXtA!QBwAW3gLA-n3M4HZSr8idKWgSRhqya5Jsgn3bxHCfXKwf78EddzuVtvXP4BzG_ra6W2YwN8bhZzidwZU0xSAgLV5$ his example.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/cliviu74/wallbox/issues/32*issuecomment-1934432001__;Iw!!D9dNQwwGXtA!QBwAW3gLA-n3M4HZSr8idKWgSRhqya5Jsgn3bxHCfXKwf78EddzuVtvXP4BzG_ra6W2YwN8bhZzidwZU08KMcfKF$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AXBOEVJQX5XATWMIAWGAW5DYSTY2XAVCNFSM6AAAAABAVMXQYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZUGQZTEMBQGE__;!!D9dNQwwGXtA!QBwAW3gLA-n3M4HZSr8idKWgSRhqya5Jsgn3bxHCfXKwf78EddzuVtvXP4BzG_ra6W2YwN8bhZzidwZU0yo-gF5y$. You are receiving this because you were mentioned.Message ID: @.**@.>>

nanomad commented 5 months ago

@cliviu74 Chiming in from italy, we do actually need the same feture for the same reason as Spain

gsxr2001 commented 5 months ago

Same problem in Italy: by joining an experiment (Arera) we have the possibility of having 6 kW from 11pm to 7am and all day on holidays; 3 kW the rest of the day. The native app does not provide the ability to set time slots and days