EVSE Keba P30 integration

FYI: Multi-wallbox support is on its way! I had some time today to prepare the underlying library (most parts rewritten). Unfortunatelly, I am not able to fully test it yet. If someone with python skills wants to help, you are welcome. Otherwise I need to wait until I have access to a multi-wallbox setup. @grandslam @thomasj ?

You can find the code here: GitHub - dannerph/keba-kecontact: Python library for controlling KEBA charging stations.
install it locally (pip install .) and modify the cli.py to setup more than one wallbox

1 Like

Iā€™m interested in this and I have two Kebaā€™s I could provide VPN access to, if you want?

1 Like

Happy new year!

I had some time to bring the keba integration almost to perfection (multiple charging station support, Web-UI config, tons of additional/optional sensors, ā€¦). It would be nice if someone of you could test the integration with your keba box(es) before I submit a PR to the core. Unfortunately, there are some breaking changes regarding unique_ids and sensor names, you need to configure your box(es) from scratch via Web-UI.
We can still discuss, which sensor should be on by default, the implemented selection is my preference (basics only but tidy :wink: ).

In order to get it running, remove keba: from your configuraiton.yaml and install the following custom integration (either manuel or via hacs). You should now be able to add wallboxes via the Web-UI.

You can find the latest version as custom (Beta) integration here:

ā€“
Philipp

Great work! Looks really promising. I removed the keba: section from my configuration and added the new version via HACS. I could then add the integration via the web without any issues.

However, the card in the integration list looks a bit dull:
Screenshot 2022-01-01 at 22.58.26
But then I renamed the integration (Rename option on the card) to only ā€œP30ā€, which caused the logo and the name to appear. So maybe the default name is too long?

I also tried to enable some of the disabled entities.

This entity then appeared in the list of enable entities, but without any data, and without the name and icon I set:
Screenshot 2022-01-01 at 23.11.10

After a restart, these entities appeared in the list. So no big problem, but perhaps a bit confusing.

I tried to rename the device to Keba P30, and wanted to let the entities automatically change name (in order to avoid having to change my automations etc), but I was not allowed to do this, as this name was already taken (ā€œEntity with this ID is already registeredā€), so I changed to another name and restarted. But after this, I was allowed change to ā€œKeba P30ā€. But after these changes, some of the entities (but not all) got weird names:
Screenshot 2022-01-01 at 23.30.14
and with corresponding entity id:s.
To get back to something good, I removed and re-added the integration. But I managed to mess up the entities again while trying to get some consistent names.

In my personal case, itā€™s no big deal if I have to modify my automations and other stuff, as I have just changed car, and will have to do some changes anyway. But I can imagine that some people would like to have an easy way of getting their entity names the same as they were previously.

I am sorry for not having more systematic feedback, but this was just a quick first look. My car is also fully charged, so I currently cant really experiment with the actual charging.

1 Like

Thanks for testing!

I created a new device info so that there is a unique naming for each device (including manufacturer, model etc. in case of multiple charging stations) with all their sensors connected. A more friendly name should be quite simple once I add more devices in the library (only could test with my BMW Wallbox Plus). I will do that tomorrow. For me also the integration looks nice with logo. Letā€™s see if it is related to the long naming or somehow with the device info extraction.

I know breaking changes are something no-one likes but in this way it is more future proof. Anyhow, I moved quite a lot of values from attributes to actual sensors and added new ones.

After enabling the deactivated entities it takes 30s until the integration is reloaded. This is normal behaviour of home assistant we cannot change. I was notified about that right after enabling the entizies. Reloading the integration fills the values at once.

Could you please test the notify to check if the display function is still working (I am not able to test it due to missing display :smiley: )?

FYI: Once you add a default RFID in the charging station configuration, the lock entity will be created. Start and stop services now have optional RFID tag and RFID class. If not given, defaults are used. If no defaults given, none are used (which should work according to the documentation but does not work for my BMW version).

When I added the integration, I couldnā€™t find the integration card at all before refreshing the configuration page. However, it turns out the card was there, but had taken over the information from another card:

The left Meross card is actually the KEBA card in disguise. (Now I donā€™t remember if I had to restart HA or just refresh the page in order to get to the empty card i showed in my previous post.)

After renaming the device (to ā€œKEBA EVSEā€) and restarting, all disbled sensors lost their name:
Screenshot 2022-01-02 at 11.17.59

When enabling a sensor (and giving it a name), I get the notice telling me that will be available after 30 seconds. Nevertheless, it doesnā€™t become available until after a full restart (reloading the integration is not enough).

Regarding the notifications; I canā€™t get it to work. But maybe I am missing some configuration details?

I have this in my configuration.yaml:

notify:
  - name: charger 
    platform: keba

which previously created a service called notify.charger, which I could use to set texts on the charger. Now I donā€™t get any such service available. Is there something I would have to do differently with the updated integration?

Deactivated entities have no name for me too, but that seems to be a general bug (the same for the BMW connected drive and shelly integration at my installation).

grafik
For me keba logo is visible, strange :thinking: I added the logos a long time ago to the home assistant branding repo. Maybe some browser or front-end caching issue? Which home assistant version are you running?

Regarding notify, there should be one general platform service that requires a target to send notificytion to and one notify per registered charging station. You can test it via the developer tools ā†’ Services. If no notify was created, my display detection method might not work correctly. (if 'P30' in model).

Could you download the latest version of the library on your computer and run python .\cli.py [IP_of_your_charging_station] and post the output? I am interested if the update, I just made, identifies the P30 correctly (it should work according to the example in the udp programming guide).

Does anybody know, how one could get the detailed model number (P30x/c/?) out of this product string? "Product": "KC-P20-ES240010-000",.

Changing the name here does not have any effect on the integration and entity naming for me:
grafik

@matli are there any errors/warnings in your logs that are related to the keba integration?

Weird thing is that the deactivated entities (in the new KEBA platform) had good looking names yesterday, but not now.

The keba logo starts appearing as soon as I change the name to something shorter. This behaviour is consistent. When installing the component, I first get the card with the wrong logo/name, then after refresh it is empty, and after a name change the logo appears. Iā€™m running HA 2021.12.4. I should probably start by updating to the latest.

How do I know what the proper target name for notify is? However, there is an error message in the log regarding the notification part:

2022-01-02 15:49:18 ERROR (MainThread) [homeassistant.components.notify] Error setting up platform keba
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 61, in async_setup_platform
    notify_service = await platform.async_get_service(  # type: ignore
  File "/config/custom_components/keba/notify.py", line 31, in async_get_service
    return KebaNotificationService(keba)
  File "/config/custom_components/keba/notify.py", line 40, in __init__
    self.targets.update({w.device_info.model: w for w in keba.get_wallboxes()})
  File "/config/custom_components/keba/notify.py", line 40, in <dictcomp>
    self.targets.update({w.device_info.model: w for w in keba.get_wallboxes()})
TypeError: unhashable type: 'list'

Here are the output from cli.py. (I redacted the s/n.)

Output
2022-01-02 15:43:42,970 [MainThread  ] [DEBUG]  Using selector: EpollSelector
2022-01-02 15:43:42,971 [MainThread  ] [INFO ]  Run Keba CLI in client mode to connect to given IP addresses.
2022-01-02 15:43:42,971 [MainThread  ] [DEBUG]  Requesting device info from 10.0.20.96
2022-01-02 15:43:42,971 [MainThread  ] [DEBUG]  Send report 1 to 10.0.20.96
2022-01-02 15:43:42,971 [MainThread  ] [DEBUG]  Socket binding created (0.0.0.0) and listening started on port 7090.
2022-01-02 15:43:42,977 [MainThread  ] [DEBUG]  Datagram recvied from ('10.0.20.96', 7090): '{\n"ID": "1",\n"Product": "KC-P30-EC2201C2-E00-CL",\n"Serial": "18xxxxxx",\n"Firmware":"P30 v 3.10.28 (210316-115052)",\n"COM-module": 1,\n"Backend": 0,\n"timeQ": 3,\n"DIP-Sw1": "0x22",\n"DIP-Sw2": "0x08",\n"Sec": 5423029\n}\n'
2022-01-02 15:43:42,977 [MainThread  ] [DEBUG]  Received something from a not yet registered wallbox.
2022-01-02 15:43:43,072 [MainThread  ] [DEBUG]  Start connecting to 10.0.20.96
2022-01-02 15:43:43,072 [MainThread  ] [DEBUG]  Requesting device info from 10.0.20.96
2022-01-02 15:43:43,072 [MainThread  ] [DEBUG]  Send report 1 to 10.0.20.96
2022-01-02 15:43:43,078 [MainThread  ] [DEBUG]  Datagram recvied from ('10.0.20.96', 7090): '{\n"ID": "1",\n"Product": "KC-P30-EC2201C2-E00-CL",\n"Serial": "18xxxxxx",\n"Firmware":"P30 v 3.10.28 (210316-115052)",\n"COM-module": 1,\n"Backend": 0,\n"timeQ": 3,\n"DIP-Sw1": "0x22",\n"DIP-Sw2": "0x08",\n"Sec": 5423029\n}\n'
2022-01-02 15:43:43,078 [MainThread  ] [DEBUG]  Received something from a not yet registered wallbox.
2022-01-02 15:43:43,174 [MainThread  ] [INFO ]  KEBA Wallbox (Serial: 18xxxxxxxx) at 10.0.20.96 successfully connected.
manufacturer: KEBA
model: P30
device_id (serial number): 18xxxxxxxx
firmware version: P30 v 3.10.28 (210316-115052)
host: 10.0.20.96
2022-01-02 15:43:43,174 [MainThread  ] [DEBUG]  Send report 2 to 10.0.20.96
2022-01-02 15:43:43,178 [MainThread  ] [DEBUG]  Datagram recvied from ('10.0.20.96', 7090): '{\n"ID": "2",\n"State": 2,\n"Error1": 0,\n"Error2": 0,\n"Plug": 7,\n"AuthON": 0,\n"Authreq": 0,\n"Enable sys": 1,\n"Enable user": 1,\n"Max curr": 6000,\n"Max curr %": 100,\n"Curr HW": 16000,\n"Curr user": 6000,\n"Curr FS": 0,\n"Tmo FS": 0,\n"Curr timer": 6000,\n"Tmo CT": 0,\n"Setenergy": 0,\n"Output": 0,\n"Input": 0,\n"Serial": "18xxxxxxxx",\n"Sec": 5423029\n}\n'
2022-01-02 15:43:43,179 [MainThread  ] [DEBUG]  Datagram received, starting to process.
2022-01-02 15:43:43,275 [MainThread  ] [DEBUG]  Send report 3 to 10.0.20.96
2022-01-02 15:43:43,280 [MainThread  ] [DEBUG]  Datagram recvied from ('10.0.20.96', 7090): '{\n"ID": "3",\n"U1": 234,\n"U2": 233,\n"U3": 234,\n"I1": 0,\n"I2": 0,\n"I3": 0,\n"P": 0,\n"PF": 0,\n"E pres": 126301,\n"E total": 73993771,\n"Serial": "18xxxxxxxx",\n"Sec": 5423030\n}\n'
2022-01-02 15:43:43,280 [MainThread  ] [DEBUG]  Datagram received, starting to process.
callback function 1: 18xxxxxxxx: {'ID': '3', 'State': 2, 'Error1': 0, 'Error2': 0, 'Plug': 7, 'AuthON': 0, 'Authreq': 0, 'Enable sys': 1, 'Enable user': 1, 'Max curr': 6.0, 'Max curr %': 10.0, 'Curr HW': 16.0, 'Curr user': 6.0, 'Curr FS': 0.0, 'Tmo FS': 0, 'Curr timer': 6.0, 'Tmo CT': 0, 'Setenergy': 0.0, 'Output': 0, 'Input': 0, 'Serial': '18xxxxxxxx', 'Sec': 5423030, 'uptime_pretty': '62 days, 18:23:49', 'Plug_wallbox': True, 'Plug_locked': True, 'Plug_EV': True, 'State_on': False, 'State_details': 'ready for charging', 'FS_on': False, 'U1': 234, 'U2': 233, 'U3': 234, 'I1': 0.0, 'I2': 0.0, 'I3': 0.0, 'P': 0.0, 'PF': 0.0, 'E pres': 12.63, 'E total': 7399.38}
2022-01-02 15:43:43,280 [MainThread  ] [DEBUG]  Executed 1 callbacks
2022-01-02 15:43:43,376 [MainThread  ] [DEBUG]  Send report 100 to 10.0.20.96
2022-01-02 15:43:43,382 [MainThread  ] [DEBUG]  Datagram recvied from ('10.0.20.96', 7090): '{\n"ID": "100",\n"Session ID": 876,\n"Curr HW": 16000,\n"E start": 73867470,\n"E pres": 126301,\n"started[s]": 1640873273,\n"ended[s]": 0,\n"started": "2021-12-30 14:07:53.000",\n"ended": "0",\n"reason": 5,\n"timeQ": 0,\n"RFID tag": "0000000000000000",\n"RFID class": "ec28ab0b000000000000",\n"Serial": "18xxxxxxxx",\n"Sec": 5423030\n}\n'
2022-01-02 15:43:43,382 [MainThread  ] [DEBUG]  Datagram received, starting to process.
callback function 1: 18xxxxxxxx: {'ID': '100', 'State': 2, 'Error1': 0, 'Error2': 0, 'Plug': 7, 'AuthON': 0, 'Authreq': 0, 'Enable sys': 1, 'Enable user': 1, 'Max curr': 6.0, 'Max curr %': 10.0, 'Curr HW': 16.0, 'Curr user': 6.0, 'Curr FS': 0.0, 'Tmo FS': 0, 'Curr timer': 6.0, 'Tmo CT': 0, 'Setenergy': 0.0, 'Output': 0, 'Input': 0, 'Serial': '18xxxxxx', 'Sec': 5423030, 'uptime_pretty': '62 days, 18:23:49', 'Plug_wallbox': True, 'Plug_locked': True, 'Plug_EV': True, 'State_on': False, 'State_details': 'ready for charging', 'FS_on': False, 'U1': 234, 'U2': 233, 'U3': 234, 'I1': 0.0, 'I2': 0.0, 'I3': 0.0, 'P': 0.0, 'PF': 0.0, 'E pres': 12.63, 'E total': 7399.38, 'Session ID': 876, 'E start': 7386.75, 'started[s]': 1640873273, 'ended[s]': 0, 'started': '2021-12-30 14:07:53.000', 'ended': '0', 'reason': 5, 'timeQ': 0, 'RFID tag': '0000000000000000', 'RFID class': 'ec28ab0b000000000000'}
2022-01-02 15:43:43,382 [MainThread  ] [DEBUG]  Executed 1 callbacks
2022-01-02 15:43:43,478 [MainThread  ] [DEBUG]  Periodic data request executed, now wait for 10 seconds
2022-01-02 15:43:45,177 [MainThread  ] [DEBUG]  Periodic requests for Wallbox P30 at 10.0.20.96 stopped.
2022-01-02 15:43:45,177 [MainThread  ] [DEBUG]  Wallbox at 10.0.20.96 removed.

The name change place you show is where I changed name for the logo to appear. However, regarding the entity renaming, I was referring to this place:


When changing the name there, I get prompted if I want to also change the entity ID:s. This was what caused the disabled sensors to lose their names (the ID:s are properly renamed though).

Ok, device info looks good. Could you update the custom component to the newest version, I just pushed, and delete an reenter the keba box? This should provide a short and friendly device name now.

Regarding notify, it seems that there is an error during platform setup, thus it will not appear under developer tools services. Let me have a look on it, I will post once I think it is fixed.

Thanks, the new version gives me a short and friendly name, both on the device and on the entities. This also seems to solve the issue with the empty integration card.

1 Like

Great work, Philipp! Yesterday I installed and tested (P30 x-series) the new BETA version with HACS. The installation went well and the sensors were immediately visible. Unfortunately I have problems with the status binaryā€™s. I donā€™t get any values back for ā€œserialā€, ā€œproductā€, ā€œup-timeā€ and ā€œfirmwareā€.
Example from the sensors.yaml:

keba_status_serial:
    value_template: '{{ state_attr("binary_sensor.keba_p30_status", "serial") }}'
    friendly_name: 'Wallbox serial number' 

Have you seen this problem before? Any suggestions?

Hi @bassfrank ,
I removed a lot of attributes from the sensors and created new sensors for them if it made sense. Serial number, product info and firmware are no real sensors but device info. Thus, they are now stored in the device info only (you can see them in tge device page of your keba box). There is a new uptime sensor under diagnostic sensors (default disabled).

Hi @dannerph ,
of course, this explains why I donā€™t see any values! :wink: Thank you for your quick feedback.I am very curious to see what else will come in the future.

Hi dannerph,

This integration is really awesome.
Would you mind sharing your setup, how you automated the charging power based on (green-solar only, fast and manual)?
Thank you

@dannerph, Did you get anywhere with the notify setup?

sorry @matli had no time for that so far, maybe this Saturday if the weather will be as bad as expected at my place :wink:

@davrog10 the new version, I am currently working on (beta in github, see link above), will be able to set the charging power in kilowatts (kW) instead of charging current in ampere (A). Thus a lot of the logic for the different modes will be pushed to the integration. This has several benefits:

  • It is no longer required to calculate the charging current (6A-63A in 1A steps) depending on your voltage for a specific charging power. The corresponding voltage is directly measured in the charging station and integrated in the calculation. There will be a service call to set a charging power and define if it should be rounded up or down to the next possible charging step.
  • It is no longer needed to take care of how many phases the car is charging, as this is also directly measured at the charging station and integrated in the calculation. (e.g. some early VW start to charge with 2 phases and switch to 1 phase in the battery saturation phase).

Currently I am testing this feature and try to make it as user-friendly as possible. In short, you need some template sensors to calculate the optimal charging power values and an automation that calls the before mentioned service depending on an input_select. I do not want to provide code examples yet, as the integration is still in beta and might change in the next time.

1 Like

Hello Together

I have two Keba charging stations in use. Is there a possibility to display two charging stations in Homeassistant? As I see it, there is only the possibility to specify a host?

Kind regards from Switzerland

Did you try to add two integrations for each?

Like:
keba:
host: 192.168.86.48
keba:
host: 192.168.86.49

or

keba:
host: 192.168.86.48
host: 192.168.86.49

I didnā€™t try as I donā€™t have 2, but Iā€™ll have 2nd one installed in about a month, so Iā€™m also curious.

Hello Davrog10

Thank you for your support.

I have tried these variants, however it does not work. As soon as I enter a second host the yaml file is marked as corrupted

I think option is also to copy the project, rename it to idk keba2, and add it to custom integrations. Then you basically have 2 seperate keba integrations. Iā€™ll soon be trying what you need, as I just got my 2nd keba charger yesterday. Iā€™ll let you posted.