openHAB-Binding for KIA/Hyundai (PH)EVs?

Hyundai - and KIA as a Hyunday subsidiary offer an App for connecting to the (PH)EVs. With KIA it’s called “KIA connect” (or KIA UVO).
There’s an (unofficial) API Wrapper on github - but unfortunately no openHAB Binding for that. There’s some for ioBroker or HomeAssistant, but none for us folks.

So I took a look at “bluelinky”, which appears to be the source for all Smarthome-integrations of the above. And I found a Nodered-Plugin, which appears to have some of bluelinky’s features, but is a wee bit older in v0.0.27 as in bluelinky.

But at first glance it works: so I can get the updates of my EV6 and can trigger some actions like (un)locking the car or trigger charging it.

Unless I put much more effort in it: Does anyone work on a binding for KIA/Hyunday connect?

(if it is of interest I can leave some more informatin on how I use the node-red-contrib-bluelinky here)

1 Like

I would be interested too :-).

Meanwhile I am using my OpenWB that connects to the Hyundai/KIA (IONIQ5) account and can be accessed from OpenHAB with MQTT as a workaround.
At least I get the SoC from there but I would also be interested in more values that are availablie in the bluelink App.
The NodeRed sounds like an improvement, could you provide more?

br Leo

That’s one problem: the SoC mostly comes “cached” and from what I read, Hyundai/Kia restricts the use of the API to not more than 100 call per day, which makes it fairly useless to monitor the Soc that way. [1]

of course. What I do is:

  1. set up node-red-contrib-bluelinky within node-red
  2. get the cached status every 15mins
  3. get the “live” status every hour
  4. use the “full status” JSON and pars out my relevant information
  5. send it via MQTT to openHAB

I also created topics for the commands like “start charging”, “stop charging”, …

see here:


(I have to sort out what I need as information and then use dynamic mqtt-Topics instead of those massive ones)

What I’m still missing is the Wallbox, as my electrician didn’t have the time yet to connect it. But how do you integrate OpenWB - I have the Tinkerforge Warp II, and this one also accepts MQTT topics…

[1] I’m working on a OBD-dongle solution, so that I can read out the OBDII-information while charging with a ESP32 arduino based board, and send it via MQTT to openHAB. openHAB will then put it all together and when finally my PV arrives (shortage of installation roof pans…), it will provide PV excess loading…

Hey,

I just found bluelinky and node red. Do you mind sharing your node red Setup?

I am really overwhelmed by it and I am still trying to understand how to set it up on node red and then connect it to openhab

at first you have to make sure, you understand what you’re doing! :wink:
so, node-red is a means to connect diverse hardware, APIs, or other data-driven sources together. much like openHAB does for home-automation; except node-red is “low code”, with a UI to achieve nearly 80% of the tasks at hand. OH has a similar low-code approach within rules, if you use blockly for it.

So, what the bluelinky node-red integration does is simply providing access to the Hyundai/Kia API and then you can use node-reds built-in methods to use the information to update OH3-items or get OH3-commands to do something with the bluelinky commands. I use the MQTT binding to import external information info openHAB and use it to trigger external hardware, more on this here:

First step is to get a feeling for node-red

next step for you is to get an overview over the bluelinky options here:

so, within node-red just add the node-red-contrib-bluelinky via option “manage palette” - “install” and then you can use the nodes provided on the left side under “bluelinky”, there’s all the on github options available.

You have to use at least the “login”-node, which I reload every 4hours:

login node
[{"id":"37ecbb20.e4fe7c","type":"inject","z":"a351eaa.aed7b98","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"14400","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":820,"wires":[["a4e75205.77e69"]]},{"id":"a4e75205.77e69","type":"login","z":"a351eaa.aed7b98","name":"Login","bluelinky":"77eb8168.bc8b58","x":230,"y":820,"wires":[["928c79a9.033078"]]},{"id":"928c79a9.033078","type":"debug","z":"a351eaa.aed7b98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":470,"y":820,"wires":[]},{"id":"77eb8168.bc8b58","type":"bluelinky","username":"your@email.here","password":"password","region":"EU","pin":"1234","vin":"yourPINhere","brand":"kia"}]

Then I use the full status node and break it down to single information, which I then send to my MQTT broker:

full status
[{"id":"c768e168.ac57a","type":"inject","z":"a351eaa.aed7b98","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"900","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":140,"wires":[["4703539f.230824"]]},{"id":"4703539f.230824","type":"car-fullstatus","z":"a351eaa.aed7b98","name":"Full Status - cached","dorefresh":false,"bluelinky":"77eb8168.bc8b58","x":320,"y":160,"wires":[["824a6cde.0267f","ed166b85.4d2ac8"]]},{"id":"824a6cde.0267f","type":"json","z":"a351eaa.aed7b98","name":"","property":"payload","action":"str","pretty":true,"x":510,"y":200,"wires":[["ed166b85.4d2ac8","c90f8db5.711df8","3b7d3b67.6e99ac","403cf6cb.e7b098","e2f706d6.e3b39","a11c5950.5c856","2ddbf40d.1bb2fc","5d11660d.c99858","4ccd246a.e548a4","59df54d4.2312ec","c7ca3a28.5e17a8","1d1460f4.3c2387","513511d2.14fa48","958dfb0e.93aab","ea8819aa.289f48","d735782f.f8c158","e1a8ef89.2de5c8","c47c7e70.10695","4d3e7fbc.8727e","232ec92a.65b69e","266dc2a3.ad6b4e","8067e9d8.40224","38c6a75d.2ceb7","a99ae00d.33555"]]},{"id":"e2f706d6.e3b39","type":"function","z":"a351eaa.aed7b98","name":"lastUpdate","func":"// JSON parsen\nparsed = JSON.parse(msg.payload);\nmsg.payload = parsed.vehicleStatus.time;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750,"y":200,"wires":[["6648e567.5c7f9c"]]},{"id":"c90f8db5.711df8","type":"function","z":"a351eaa.aed7b98","name":"batteryStatus","func":"// JSON parsen\nparsed = JSON.parse(msg.payload);\nmsg.payload = parsed.vehicleStatus.evStatus.batteryStatus;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":760,"y":240,"wires":[["14e95857.3047d8"]]},{"id":"6648e567.5c7f9c","type":"rbe","z":"a351eaa.aed7b98","name":"nur neue","func":"rbe","gap":"0.6","start":"","inout":"out","property":"payload","x":980,"y":200,"wires":[["e7409718.2b5dc"]]},{"id":"14e95857.3047d8","type":"rbe","z":"a351eaa.aed7b98","name":"nur neue","func":"rbe","gap":"0.6","start":"","inout":"out","property":"payload","x":980,"y":240,"wires":[["56422ed4.feabd8"]]},{"id":"e7409718.2b5dc","type":"mqtt out","z":"a351eaa.aed7b98","name":"mqtt","topic":"openHAB/master/Kia/lastupdate","qos":"1","retain":"true","broker":"4672ca10.309984","x":1130,"y":200,"wires":[]},{"id":"56422ed4.feabd8","type":"mqtt out","z":"a351eaa.aed7b98","name":"mqtt","topic":"openHAB/master/Kia/batteryStatus","qos":"1","retain":"true","broker":"4672ca10.309984","x":1130,"y":240,"wires":[]},{"id":"77eb8168.bc8b58","type":"bluelinky","username":"your@email.here","password":"password","region":"EU","pin":"1234","vin":"VIN","brand":"kia"},{"id":"4672ca10.309984","type":"mqtt-broker","name":"Synology","broker":"YourBrokerURLIP","port":"YourBrokerPort","clientid":"YourClientID","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"openHAB/master/nodered","birthQos":"2","birthRetain":"true","birthPayload":"ON","closeTopic":"openHAB/master/nodered","closeQos":"2","closeRetain":"true","closePayload":"OFF","willTopic":"openHAB/master/nodered","willQos":"2","willRetain":"true","willPayload":"OFF"}]

last step is to send commands to the car, in that case node-red listens to topics and triggers an action:

cmd Car
[{"id":"191cf448.4a4e04","type":"start-charge","z":"a351eaa.aed7b98","name":"Start Charging","bluelinky":"77eb8168.bc8b58","x":300,"y":440,"wires":[[]]},{"id":"98fea53f.45f8d","type":"mqtt in","z":"a351eaa.aed7b98","name":"cmdStartCharging","topic":"openHAB/master/Kia/cmdStartCharging","qos":"2","datatype":"auto","broker":"4672ca10.309984","x":100,"y":440,"wires":[["191cf448.4a4e04"]]},{"id":"77eb8168.bc8b58","type":"bluelinky","username":"your@email.here","password":"yourPassword","region":"EU","pin":"1234","vin":"YourVIN","brand":"kia"},{"id":"4672ca10.309984","type":"mqtt-broker","name":"Synology","broker":"YourBrokerURLIP","port":"YourBrokerPort","clientid":"YourClientID","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"openHAB/master/nodered","birthQos":"2","birthRetain":"true","birthPayload":"ON","closeTopic":"openHAB/master/nodered","closeQos":"2","closeRetain":"true","closePayload":"OFF","willTopic":"openHAB/master/nodered","willQos":"2","willRetain":"true","willPayload":"OFF"}]

With that you can start your own way to deal with this… :wink:

I would be interested in this binding as well. I would be happy to do any testing once the Hyundai EV finally arrives sometime this summer.

I’m also interested, while waiting for my Kia EV6 so I would be able to support testin once I’ve got it. :wink:

That’s great - but I guess, there’s no binding available or even in the planning.

But the bluelinky-API-wrapper and integration into node-red works for now. You have to integrate it yourselfes - I use MQTT for that.

Hello all

Now I’m new to trying to get this working. I did get as far as I have bluelinkly installed and perharps setup it seems like I can login but I do not know how to verify response, I been told in another thread that it should be some sourcode lying around here somewhere but I cant find it, maybe I just thinking in a bad way. But how should the json and function be configured?

Goodmorning

I must have been tierd yetserday, I didn’t find the arrows to find code for adding flows in node red. However the function says unkown function is there som addon missing?

As their is no official API documentation available for Bluelink (please let me know if I am wrong) and there is no Java client library as well, it is improbable that somebody will develop an openHAB binding for Hyundai Bluelink/Kia UVO (my opionion).
Theoretically, there might be some way of using bluelinky from Java by using GraalJS in the NodeJS mode, but that also sound like a lot of work and I am also not sure whether this works with the single-threaded openhab-distro.

This would be really much work, as you‘d need to have a deep look at bluelinky to see how the API works (in fact you‘d need to reimplement bluelinky in Java) and then create a binding around that.
Creating a binding when you‘ve got a good library or some good API docs is not the problem here, but the missing API docs and/or the missing Java library.

Hence, I will also use node-red-contrib-bluelinky (node) - Node-RED and publish the data to openHAB using node-red-contrib-openhab3 (node) - Node-RED.

In case anyone reading this thread is interested … I use this Huyndai-Kia-Connect-API python package, which worked without any issues.

Where ist this API running and how do you connect it to OpenHAB?

Hello all

My Node red function works quite good, but there is one issue. It seems like my Get status (live status) doesn’t work properly. Is there anything I need to change or does this looks right? I use the same config for booth full status - cached and get status so I would thing that it works, but injecting timestamp för get status doesn’t update the status.

I do get an error meassege in debug window TypeError:
Cannot read properties of undefined (reading ‘evStatus’)