[BETA] Wallbox Charger

Hubitat integration with wallbox ev chargers

Introduction

This driver is for integrating Hubitat with your Wallbox EV Charger.

Pre-Requisites

  1. A Wallbox EV Charger connected to the intenet
  2. Your credentials for the my.wallbox portal
  3. Your charger ID. This is the charger's serial number that you can see in Wallbox app, Charger Info screen

Supported Features
The initial version of the Hubitat drivers support the following capabilities:

  1. Retrieve certain attributes of the charger (i selected the ones I thought were useful, there are more let me know if you need any to add them)
  2. Pause/Resume charging
  3. Set maximum charging current (in amperes, varies with the model/region - in Europe 6A to 32A)
  4. Restart the charger

Not supported features

I have built the driver for a single charger. It would be possible to auto-detect multiple chargers in an account, as well as the groups hierarchy used by wallbox, but for now I created a simple one-device driver. If there is the need for more complex implementation I may consider in the future.

I have only tested with a Pulsar Plus charger, European 22kw version.

Installation

  1. Copy the code for the driver into Hubitat
  2. Create a new Virtual Device of type Wallbox Charger
  3. Enter the correct parameters for the configuration
    a. Username used for the wallbox portal
    b. Password used for the wallbox portal
    c. Id of the charger (as described in pre-requisites)
    d. Token validity: driver refreshes access token if more than x days have passed. As far as I know, validity currently stands at 15 days
    e. Log Level: i. 0: Error only ii. 1: Also Warnings iii. 2: Also Information iv. 3: Also Debug v. 4: Also Trace
    f. Press Save Preferences
  4. Press Refresh to retrieve charger data

** Usage **

I believe commands are self explanatory

4 Likes

Cool but it doesn't work yet :slight_smile:

Followed instructions but no go..

My bad, there was a bug with the initialization and handling of the token, which I didn't notice because I wrote the code after having retrieved a token.

Please get the code again from github. You can either delete the device and add it again, or I added a new command for resetting the token, just press it before executing refresh and it should work.

Thanks!

1 Like

No worries. Great job and I'm able to test now.
Couple of things:

  • status or other information do not update automatically or...do not update in few minutes. So user need to do manual "refresh" for the device. You can test it by looking "statusName". Set charger to pause and wait for it to update to hubitat side. It doesn't most likely happen.
    I do not know how it is made on HA side but it updates information almost realtime.

  • really slow to send commands (pause, resume for example). Not sure if it has nothing to do with your code but it takes 2min to set pause/resume.

  • I think we need all the attributes that we have been using with HA side. Definitely charging power and charging speed atleast.

Hi, thanks for your feedback.

Regarding updates to data: my approach is that the device driver should not auto-refresh. As data is pulled from the server, and not pushed to Hubitat by wallbox, my suggestion is that you create a rule in Rule Machine to trigger the refresh command as often as you like. I am not sure though if Wallbox has any limitations in volume of API calls.

As for slow commands, I tried with Lock/Unlock and the app is updated almost instantly. Mind you, I am far from the charger itself to confirm that the charger is actually locked, but at least the app is updated, so even if it is late it would not be something under my control. For Pause/Resume, my car is currently unplugged so I cannot test this - the API returns Forbidden in this case. But yesterday when testing I don't remember it taking a long time. Try checking logs (increase logging to 4) to see if API call is triggered immediately, if yes then any delays are not under the control of the driver.

Finally, about attributes, I will have a look at HA implementation to see what API calls are being used and attribute mapping, and will get back with a new version. Some of the attributes I see in the screenshot are not provided by the API I am using.

1 Like

Thanks for the comments. I need to test more. I also need to test if running pause/resume commands takes as much time with Wallbox app too. Then it's something else and not related to your wb driver.

Refresh rule makes sense..kind of.. I been using HA integration and that's instant. I was wondering if wb server is pushing changes and information automatically forward but it seems like it is not.

One thing. I see a poll option in device and makes me wonder if there is a possibility to set poll timer to device? It would be so much nicer than create a rule to webcore (os rule engine) to run poll from there.

It is possible, of course, let me have a look if i can do something configurable because I don’t want it active for myself :wink:

But, just curious why you prefer the driver itself to autoschedule instead of a rule? With a rule you can get far more control over conditions and schedules for triggering a refresh, without any code.

In the meantime I could not workout which APIs HA is using to retrieve all the attributes. I found for added energy and power, but needs reengineering of some code - the only api i found retrieving this is the one getting all chargers in the account. Will have a look over the weekend.

Thanks!
About the polling. I think it more like this.. all the devices report exact realtime status and with that information I'm able to do next level stuff like automation.. "if-then-else things" in webcore. Some of the devices that I use are not able to report status to Hubitat but I see it as a Hubitat's job to deliver and if it's possible to update status on Hubitat side it's more convenient for me :slight_smile:
It's true that same thing can be achieved by using webcore or rule engine but I want to run next level automation there and not to update status of the certain device.
I do not understand much about coding or creating device drivers so I'm really happy what you have done already. So it is up to you and at the moment it is just me who is asking this :smiley: So no pressure there.

About the attributes. Not sure if HA side helps you at all but here's the topic:

Thanks I will have a look to that link.

Please note I use Hubitat only, and when I meant rule engine, I meant Hubitat's Rule Machine. For example, with the below you can get the device to refresh every 30 seconds but only between 8am and 8pm

So, I found the API information. I will change the driver to map information as follows

API Response Device field
user_id: 99999,
user_name: XXXX,
car_id: 1,
car_plate: ,
depot_price: 0,
last_sync: 2023-04-21 07:52:10,
power_sharing_status: 0,
mid_status: 1,
status_id: 194, status
name: PulsarPlus,
charging_power: 1.4238, power
max_available_power: 32, max_available_power
depot_name: Family,
charging_speed: 0, charging_speed
added_range: 1, added_range
added_energy: 0.163, energy
added_green_energy: 0,
added_discharged_energy: 0,
added_grid_energy: 0.163,
charging_time: 454, charging_time
finished: false,
cost: 0, cost
current_mode: 3, current_mode
preventive_discharge: false,
state_of_charge: null, state_of_charge
ocpp_status: 1,
config_data: {
charger_id: 999999,
uid: XXXXXXXXXXXXXXXXXXXX,
serial_number: 999999, serial_number
name: PulsarPlus, name
locked: 0, locked
auto_lock: 0,
auto_lock_time: 60,
multiuser: 0,
max_charging_current: 6, max_charging_current
language: EN,
icp_max_current: 0,
grid_type: 1,
energy_price: 0.1912, energy_price
energyCost: {
value: 0.1912,
inheritedGroupId: null
},
unlock_user_id: 999999,
power_sharing_config: 256,
purchased_power: 0,
show_name: 1,
show_lastname: 1,
show_email: 1,
show_profile: 1,
show_default_user: 1,
gesture_status: 7,
home_sharing: 0,
dca_status: 0,
connection_type: 1,
max_available_current: 32,
live_refresh_time: 30,
update_refresh_time: 300,
owner_id: 999999,
remote_action: 0,
rfid_type: null,
charger_has_image: 0,
sha256_charger_image: null,
plan: {
plan_name: Business,
features: [
DEFAULT_FEATURE,
POWER_BOOST,
MOBILE_CONNECTIVITY,
CHARGER_SUBGROUPS,
USER_SUBGROUPS,
DYNAMIC_POWER_SHARING,
PAYMENTS,
SET_UP_INCLUDED,
BULK_ACTIONS,
AUTOMATIC_REPORTING,
BILLING,
STATISTICS
]
},
sync_timestamp: 1682063163,
currency: {
id: 1,
name: Euro Member Countries,
symbol: €,
code: EUR
},
charger_load_type: Private,
contract_charging_available: false,
country: {
id: 90,
code: GRC,
iso2: GR,
name: GRECIA,
phone_code: 30
},
state: null,
timezone: Europe/Athens,
part_number: PLP1-0-2-4-9-PP1-E,
software: {
updateAvailable: false,
currentVersion: 5.16.37,
latestVersion: 5.16.37,
fileName: plp1.tar
},
available: 1,
operation_mode: wallbox,
ocpp_ready: ocpp_1.6j,
tariffs: [],
mid_enabled: 0,
mid_margin: 1,
mid_margin_unit: 1,
mid_serial_number: ,
mid_status: 1,
session_segment_length: 0,
group_id: 999999,
user_socket_locking: 0,
sim_iccid: null,
ecosmart: {
enabled: false,
mode: 0,
percentage: 100
}
}

I don't see much use for other fields, but it may apply to someone else's use case, so am happy to include if asked to.

1 Like

GREAT! I will test it asap when you are done. Have a nice weekend @pedro.f.andrade :slight_smile:

It is done. I also added scheduled refresh capability, but I still believe it is better to schedule with a rule. But it should work. Thanks for testing it!

Just for my reference, what model of charger and car are you using this with? Do you get:

  • any value for state_of_charge attribute?
  • a realistic value for added_range?

I am using a Pulsar Plus so far with a Volvo PHEV (soon to get a EV), and the state_of_charge is always null, while added_range gives a completely unrealistic number

1 Like

Refresh works! Thank you!
I'm using same charger as you. Wallbox Pulsar Plus. Car is Polestar 2.

Added range is somewhere there. Polestar 2 (and a lot of other EV's) cannot send information back to Wallbox so it's best guess and calculated somehow.
At the moment as I'm charging it shows:
image
image
..which is ...well my battery is 69KW and I get something like ~380km at summer.

State of Charge is always "null" and at HA side for example it's always "unknown" ..so it has never shown nothing special.

Driver looks good!! I need to test it more and maybe I'm switching from HA use to Hubitat side. Actually lack of wallbox integration was the biggest reason I took HA to my system.

Great, thanks for letting me know.

2.5kwh for 20km range would make your car’s range over 550km. Of course, if the charger doesn’t know what car you have it is not possible to be accurate. I am getting my BEV this week, will check if something is different afterwards.

Hi @pedro.f.andrade . Is there a way to make Wallbox device to be used with SharpTools? Sharptools is a dashboard app for Hubitat (also HA) users and at the moment SharpTools doesn't recognize Wallbox device with its attributes as a device that could be used.
I have learned that device driver should have "capabilities" so that SharpTools is able to use device with all its attributes. Could it be possible to add capabilities for a driver? @josh from SharpTools could be the right guy to help (us) you out :slight_smile:

The device would either need to support one of the core capabilities from the SharpTools authorization list or at least a generic Actuator or Sensor capability to authorize it manually.

List of 'core' capabilities for authorization
switch, motionSensor, lock, siren, thermostat, mediaController, musicPlayer, speechSynthesis, colorControl, valve, contactSensor, waterSensor, presenceSensor, temperatureMeasurement, pushableButton, fanControl
1 Like

I actually added Switch capability to drive code and after that pulsar device was ready to be authorized to sharptools but device did not ever show up. That is probably just because I do not know what else should be added to drive code than capability line.

You shouldn't need anything other that that just for authorization purposes, but if you authorized the new device through your SharpTools User Page → Manage Connections, keep in mind that Hubitat has been having some issues with their OAuth Servers lately which could impact you.

You could try updating the device selections within the SharpTools Hubitat app (within the Hubitat hub UI), and proceed through the 'Next' confirmations to see if it will sync over the new device that way.

It works now. I tried once again adding switch capability and now I'm able to use Pulsar on my SharpTools dashboards. Thanks Josh!

1 Like