Wallbox : API Episode 2

Background

In the previous episode about "using API and Wallbox", we have seen some interesting ways to interact with the charger. In this episode, the goal is to add some more practical examples. Indeed, if you are following my GitHub repo on this topic, I have added some functions for pausing, resuming the charging session as well as locking and unlocking the charger. Also, I can set the charging power to a certain number of Amps. Let's see this in action !

Wallbox Commander

With this, it will be easy to create a little interface to use all these functions, please welcome Wallbox Commander ! A suite of tools to interact in real time with the charger.


This is a good example of reusing previously created functions.

You can check the status in almost real time on the my.wallbox.com website : 


After a certain period of time (I think 5 minutes) real time information is disabled. You can re-enabled it by the click of a button.


I have noticed the charger cannot be locked/unlocked when connected to the car, whatever the charging status is. You can only lock/unlock the charger when nothing is connected. When the charger is locked, it means nobody can use it (or steal electricity on your back).

Let see the script in action and set the charging power to 10A and then back to 32A :



Sometimes, the display on the Wallbox portal is a bit delayed, but if you have a doubt about the outcome of a command, simply refresh the web page to have the most updated status. Remember, your charger is local but needs to report his status on the Wallbox portal.

You can find my code on GitHub, it will evolve as soon as I have more functionalities to add. The ultimate goal is to interface some actions on my Home Automation system.

I hope this helps !









Comments

  1. Hi Fréderic,

    What a wonderful job you did here! I am working on an integration of my Commander Wallbox with our Loxone home automation system, and your work provided all communication information I needed.

    I had to modify two things:
    1) wbGetSessionList: the 6-digit number in the URL is different in my case. I could detect my number by 'sniffing the API' :-). I don't know where that number comes from, or if it ever changes.
    2) wbGetCharger: our configuration has 2 'Organisations', so I had to add an additional for-loop to fill chargerInfo.
    For easy maintenance, I've put those 2 items in wbCredentials, and adapted the function calls.

    All the best,
    Bart - also Belgian

    ReplyDelete
    Replies
    1. Hi Bart, thanks a lot for the kind words. You are right about the 2) I received the same comment on GitHub, the issue has been accepted and fixed ! I'm glad it helps, this is the whole concept of this blog. I hope to see you again around ;)

      Delete
    2. Hello Frederic ans Bart, sounds like you could be my saviours! I have been struggling to get any help from Wallbox to integrate two Copper SB’s in our Loxone setup but you might have been already been cracking that one. I’d like to see the status of the charger in Loxone, have Loxone strat/stop a charging session and modify the charging amps. I initially started going the modbus route but Wallbox is not publishing the modbus registers and connecting a modbus RTU master to the chargers was messing up the Powersharing function. How are you setting up Loxone to make the magic happen? Happy New Year from BE too :)
      Alban

      Delete
    3. Hi Alban,

      I've basically put the php scripts on my NAS, which functions as a web server.
      Loxone calls these scripts with Virtual Inputs (actual charging power, lock status, session energy and status) and Virtual Outputs (lock, unlock, pause, resume, max current). These virtual signals are linked to the Loxone Wallbox-block.

      This all works nice, except the session energy: Loxone needs a vehicle connected or disconnected-signal to reset the session, and I didn't take the time yet to figure that out.
      Other than that, I use the Loxone Energy Manager to control the charging current: the Belgian Capacity penalties force me to cap the charging power to 2,5 kW. This system works very neatly together with our solar panels/home battery capacity control.

      BR, Bart

      Delete
    4. Bart, what do you mean about the Belgian capacity penalties ? I'm charging every days at 7 kWh ....

      Delete
    5. Since Jan 1st 2023, we (in Flanders/Belgium) will have to pay for 'excess peak power usage'. Regulators want to stimulate that we consume electricity spread over the day. So as charging the car is not an urgency, the car gets the power that is left. We use a threshold 'kwartiervermogen/puissance quart-horaire' of 2,5 kW.

      Delete
    6. Bart, true, same in South part of Belgium but only if your house is equipped with a smart meter (which is a work in progress). This is currently not my case yet.

      Delete
  2. Thanks for your great blog. Do you know if it is possible to send a restart command to the charger using the API? Thanks!

    ReplyDelete
    Replies
    1. Hi Chris, I'm not sure ... Haven't found it yet ...

      Delete
    2. Chris, yes apparently you can with this endpoint : https://api.wall-box.com/v3/chargers/xxxxxx/remote-action But I still haven't found howto use it so far ...

      Delete
    3. Ok, you need to send {"action":3} and it will restart the unit. I will investigate further but it seems to be accurate.

      Delete
    4. I just managed to make it work ;) Follow this space, I will publish the solution very soon.

      Delete

Post a Comment

Thank you for your message, it has been sent to the moderator for review...

What's hot ?

ShredOS : HDD degaussing with style

Nutanix : CVM stuck into Phoenix