@dannerph I have the same problem as @reithm08 and would like to configure multiple charging points. Would really appriciate if this could be added. Thanks for the great work!
FWIW, I would also appreciate multi device support. Is there anything we can do to help? Thanks!
Hi all,
multi device support is non-trivial. The keba charging stations always sends its UDP responses back to port 7090. When using the Asyncio UDP transports and protocols (as I did), the listening UDP port will be already bound by the first connection. Thus, a re-design of the whole library would be required (-> independent sending and receiving, storing the responses in a map to deliver it to the correct request).
As I do not own multiple charging stations it is hard for me to debug and not a necessary feature I am willing to spend time on, sorry.
However, if someone of you wants to work on this feature I would suggest to start with a fork of my python library (GitHub - dannerph/keba-kecontact: Python library for controlling KEBA charging stations.). Once your version supports multiple devices, I can help with the home assistant integration.
BR
Philipp
@matli as dannerph is not able to commit this change, could you help? I am happy to assist in any way but I dont have the programming skills needed unfortunately.
Sorry, same problem here. I donât have access to multiple stations and would therefore have difficulties developing such functionality, and would also have a hard time justifying putting time into that.
Hello,
I am a new owner of a P30 c-series and I have tried the integration: everything works flawlessly! Many thanks for the effort done!
I have a question though: is it possible to retrieve the other info like the firmware, serial, etc.?
What about the loading sessions?
I have registered 2 smartcards and Iâd like to store the loading sessions of each card separately. Thanks!
I am also a new owner of a Keba P30 x-series without RFID reader (standalone without an OCCP, Vattenfall âbrandedâ). I have activated the keba integration in the configuration file, all entities are created and the sensors are being updated correctly. Unfortunately, I can not really get the services to work. The commands (authorize, de-authorize, enable, set_energy) are fully ignored by the wallbox. I tested with authentication on and off in the wallbox settings, without any difference in the outcome. Is it required, that the RFID string must match an existing, registered RFID card? Because my wallbax has no RFID reader, I can not edit any card settings. Starting and stopping the wallbox via the WebGUI of the box is possible. When charging, the keba.disable
service is properly executed though, and charging is stopped. I am a little confused, because I can not find any further description on how to use the integration or if further setup steps are required. Could it be, that my box hardware version might not be remotely controllable by this integration? How can I activate further logging? Any help or suggestions are appreciated.
Hi @vic,
the firmware version is part of report 1, which is already fetched. However, we only take the product value form this report. So technically it is possible, but I do not see the need for that in home assistant (convince me to be wrong ).
The report 1xx that contains the charging session history is not implemented yet. There is no straight forward way to convert this history data in a form so that home assistant can store it conveniently. If you have an idea, feel free to fork and improve the python library
Hi @stefankns,
I guess you are the first user here with a KEBA charging station without RFID. I quickly checked the documentation and it seems that the RFID is optional, which I used as mandatory in the python library (I was not aware that such a configuration exists).
Solving this issue should be fairly easy. However, I would need some testing with your device. Are you able to run a python script?
Hi @dannerph,
thanks for answering. Yes, I can do some testing with the device and I think I can run scripts. I have installed Home Assistant on Hass.IO as a VM and have not run a python script in that environment yet, but I will figure it out. Just tell me what to do.
After my post, I dug a little deeper and it might be worthwhile to share my insights. Upfront, the info about the exact model type of my box: KC-P30-EC2401B2-L00. As stated, no RFID. So I tried to play around with Packet Sender to communicate with UDP packets directly. I got it running and all info and report messages work as expected. But I realized, that with my actual authentification settings, starting a charging session without a valid RFID tag number does not seem to be possible. This left me with the problem, that editing the local RFID whitelist is not possible without a card reader installed. After re-booting the wallbox several times I realized though, that the wallbox seems to take some time to understand, that it is not equipped with a RFID reader. The RFID menu showed up some seconds and I could retrieve the URL ( âhttp://hostname/whitelist.phpâ ). Beeing authenticated to the WebGUI, that link is still working even when the RFID menu is disabled/removed from the interface. So, in the end I managed to add an 8 digit RFDI tag number to the whitelist. With Packet Sender and the UDP Start command, I was now able to successfully initiate a charging process and also to stop it again with the UDP Stop command. Nevertheless, the integration is still not working with that RFID number in the `configuration.yamlâ file, but I read from your post, that you might have a solution for this?
What I actually wanted to test is, if the wallbox starts charging when sending the start
command via udp without RFID number, which does not seem to work if I have not misinterpreted your tests?
According to the UDP programming guide, the RFID tag and RFID classifier are optional. My quick solution would have been to simply not send an RFID tag as part of the start command in case none is configured.
https://www.keba.com/web/downloads/e-mobility/KeContact_P20_P30_UDP_ProgrGuide_en.pdf
Maybe this could help you: According to the manual (page 21) of my BMW Wallbox Plus (which is internally a Keba P30 without display), it is possible to disable RFID using the service button.
Hi again,
ok. I understand your thinking. I will try to run an âemptyâ start command (without any RFID number) tomorrow again, but I will have to do some tests with different authorization settings. Right now Authorization is âonâ, Online Authorization is âFirstLocalâ and Offline Authorization is âOfflineNoChargingâ. Would be helpful to understand more how the different wallbox hardware configurations and authentication settings influence the behaviour with respect to the UDP command protocol.
My intention was, to use the UDP communication (or the keba integration of yours) to be able to lock and unlock the charging station, because the wallbox is located in an semi public space. So I would also like to further investigate, why the integration is not working for me, when UDP command line commands with Packet Sender and a âfakeâ RFID tag number do the job now. Is there any chance to see the response from the box (detailed logging on home assistant side) to the start
command sent by the integration? I cannot see any log entries in the wallbox log about denied commands or similar.
To enable debug logging, add the following to your home assistant configuration file:
logger:
default: warning
logs:
homeassistant.components.keba: debug
# wrong: keba: debug
keba_kecontact: debug
UDP is stateless, however the box will reply with âTCH-OK :doneâ, if the command was successful and with âTCH-ERR:(specific error message)â otherwise, if I remember correctly.
Thx. Hm. When I copy that into my configuration.yaml
and re-start HA i get:
Logger: homeassistant.setup
Source: setup.py:178
First occurred: 22:47:55 (1 occurrences)
Last logged: 22:47:55Setup failed for keba: Integration failed to initialize.
Seems that I am doing something wrong here.
EDIT: had to restart home-assistant host and the Wallbox. Now logging works.
The logs are empty, when executing one of the services of the integration (e.g. keba.set_energy
).
When starting the charging process via ocpp or the WebGui and sending a stop
by HA, there is the following message in the log
Command rejected: TCH-ERR:nothing to stop
23:04:53 â (WARNUNG) /usr/local/lib/python3.9/site-packages/keba_kecontact/keba_protocol.py
Looks like UDP comm is really working (otherwise all the status would not be updated either, right?)
The ânothing to stopâ might be related to sending a stop
with an RFID tag, that was not used to start the charging session would be my explanation.
As said, I will change the authorization settings tomorrow and give feedback, if there is a combo that is working.
I did some tests now , but the results are rather confusing for me. First of all, changing settings related to authorization in the WebGui of the wallbox without re-starting it (also in case it is not asking for it) sometimes leaves the box in a - for me - non-reproducible state.
About the start
command:
It does not matter if authorization is on or off, in both cases, an âemptyâ start command (e.g. packetsender -u -a <ip> 7090 "start" -w 2000 -b 7090
) results into
Response ASCII:TCH-ERR:: wrong parameter count\n
So, in contradiction to the programming guide, the token seems not to be optional. When authorization is off, a start
command with an existing or non-existing RFID token (e.g. packetsender -u -a <ip> 7090 "start 12345678" -w 2000 -b 7090
) results into
Response ASCII:TCH-ERR:no need for start\n`
which is not surprising.
General behaviour with setting âauthorization offâ:
With this setting, the through the integration offered services keba.set_energy
, keba.set_current
are working. For keba.authorize
and keba.deauthorize
nothing happens (checked by report 2
) and nothing shows up in the debug log. The same for keba.enable
and keba.disable
. Interesting is, that both, enable (ena 1
) and disable (ena 0
) work flawless from the console with Packet Sender. I can follow these changes also in the status of the wallbox at http://<wallbox-ip>:8080
.
What is the exact string, that is sent by keba.enable
and keba.disable
by the integration? Would it make sense to put the send-string in debug-logging level into the log-file?
Another thought I had is, that I might have a rather unusual setup here:
SmartHome VLAN - DLAN Bridge - Unifi AP 801.11ng â Wallbox WLAN.
This sometimes introduces quite a high latency. This is why I wait at least 2000ms for a reply in Packet Sender. Yes, UDP is stateless, the command should be executed anyway, but the reply might get lost for error handling or logging. What wait time is used in the implementation?
I also forgot to mention the software version of my wallbox in the previous posts. It is release version 1.12.1.
The ânothing to stopâ might be related to sending a
stop
with an RFID tag, that was not used to start the charging session would be my explanation.
that is correct, stop is sending the configured RFID tag. if there is no charging session running with that RFID tag, stopping should not be possible.
The string for keba.enable
and keba.disable
is âena 1â and âena 0â, respectively:
All commands are debug logged:
The python library uses the suggested 100ms waiting time after each command sending. Replies are handled in an asynchronous way - meaning, once a reply is received on the separate listening socket it is processed.
My wallbox does not have any settings via web interface nor OCPP, so I am not able to test our specific case.
I need to apologize, I mistakenly send you a wrong (old) debug logger config, it should be the following to see the debug messages of the library:
logger:
default: warning
logs:
homeassistant.components.keba: debug
keba_kecontact: debug
Thanks for the links and the infos. Now I understand better, how the integrations works. I have changed the logging settings and I am glad to be able to see the debug info now. The picture is as follows:
When I call the service keba.setenergy
from the HA interface i get:
2021-11-10 10:04:58 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send setenergy 25000.0
2021-11-10 10:04:58 DEBUG (MainThread) [homeassistant.components.keba] Fast polling enabled
2021-11-10 10:04:58 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send report 1
2021-11-10 10:04:58 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send report 2
2021-11-10 10:04:58 DEBUG (MainThread) [keba_kecontact.keba_protocol] Datagram received.
2021-11-10 10:04:58 DEBUG (MainThread) [keba_kecontact.keba_protocol] Command accepted: TCH-OK :done
2021-11-10 10:04:58 DEBUG (MainThread) [keba_kecontact.keba_protocol] Datagram received.
2021-11-10 10:04:58 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send report 3
2021-11-10 10:04:58 DEBUG (MainThread) [keba_kecontact.keba_protocol] Datagram received.
2021-11-10 10:04:58 DEBUG (MainThread) [keba_kecontact.keba_protocol] Execute callback
Looks expected to me. Especially the Command accepted
line is in match with the command being executed by the wallbox properly.
When calling keba.enable
the logs look like this:
2021-11-10 10:05:45 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send ena 1
2021-11-10 10:05:45 DEBUG (MainThread) [homeassistant.components.keba] Fast polling enabled
2021-11-10 10:05:45 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send report 1
2021-11-10 10:05:45 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send report 2
2021-11-10 10:05:45 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send report 3
2021-11-10 10:05:45 DEBUG (MainThread) [homeassistant.components.keba] Periodic data request executed, now wait for 2 seconds
2021-11-10 10:05:46 DEBUG (MainThread) [keba_kecontact.keba_protocol] Datagram received.
2021-11-10 10:05:46 DEBUG (MainThread) [keba_kecontact.keba_protocol] Datagram received.
2021-11-10 10:05:46 DEBUG (MainThread) [keba_kecontact.keba_protocol] Execute callback
There is no charging process started on the wallbox, but I can neither see a Command accepted
nor Command rejected
line as expected from the code that you showed.
Right now, I can only see these reason:
-
The command is never sent.
-
Exactly this UDP command is ignored by the wallbox when sent through HA/HA host (but working properly from command line with
Packet Sender
from another computer). -
There is no datagram coming back from the wallbox at all (meaning the
datagram received
lines are associated with thereport
requests). -
The response is malformed/unexpected, so that the code in
keba_protocol.py
line #40 and #44 does not output anything.
I personally have the impression, that #1 or #2 might be the hottest candidate, because #3 and #4 would not be an issue in the first place if the command would be executed.
Any ideas how I could test #1 and #2? I am at my limits with HA here but willing to learn. I checked all my wallbox log files, that I can access, and there is nothing in there for the timestamps of the sent commands.
Hi @dannerph,
thanks for the feedback.
Got you point on the FW version
For the report 1xx, what about using the fields as attributes?
I am a bit overloaded in this period. As soon as I have some free time I will make some tests with the Python library.
In the meantime I have found a nice and simple app with a similare scope: Wallbox control (https://play.google.com/store/apps/details?id=com.chk.go_elocal). Iâd like to replicate that level of info in HA.