I thought I had it figured out but I am still having troubles getting through curl returning binary. Any suggestions welcome
Right and I was not asking YOU to solve this.There are others that have Hyundai Blue Link out there and maybe we could work together to build something that can make it work through HASS.
ok, I found a node that does this: https://hacksore.github.io/bluelinky-docs/
integrating it into homeassistant will be next job.
I would be interested in how you could do that.
I am new to API’s and would like to get the vehicles status inside HASS
Step 1, do you know how to program and use curl? FYI. I found a group that had already started what I wanted. I am just working with them.
No actually not.
Please keep me updated! I am very curious.
It works great. I am using it through code-red now. Developers are super nice too.
Could you please share what you’ve found, either a link to it, or the code here?
Hey mrand, I think he just had a typo. The npm for bluelinky has been made into an integration for Node-Red. With that, it’s pretty trivial to get it going with home assistant.
I’m using the hassio add ins for Node-Red and was able to get car status and lock/unlock the doors.
Thanks for confirming the node-red version works (I did notice the reversed words). I am also interested if @downbound had successfully done it with curl - I can’t quite tell from his wording.
Hi! I’m one of the main contributors for bluelinky. I just want to note that i’m an active Home Assistant user myself, and that if you want to discuss usage and integration, you are very welcome to our Discord server https://discord.gg/HwnG8sY
I do not use curl, because with the clues in this thread I found a much easier method using Node-Red (I had never used Node-Red before).
The steps I took were as follows:
- Within Home Assistant get the Node-Red Add-on in the Add-on store.
In the configuration tab configure the following items:
credential_secret: your_secret http_node: username: pick_your_name password: pick_your_pwd http_static: username: pick_your_name password: pick_your_pwd ssl: true certfile: fullchain.pem keyfile: privkey.pem require_ssl: true system_packages:  npm_packages: - node-red-contrib-bluelinky
I am on SSL, but you may not be. You now have the Node-Red Bluelinky package installed.
Now you need to be ready to input your login details for the Bluelink App, your pincode for the app and your VIN: vehicle identification number. This last number is in your car’s official papers.
In the left hand column of Home Assistant click on Node-Red. This loads all the required packages, including Bluelinky
Scroll down to the greenish buttons in the left hand column and pull the “Car Status” item listed under Bluelinky into the workspace. If you click on it you can configure this node with the data above. Do not forget to fill in the Region and the car’s brand. These are required.
Under Common pull the Inject node into the workspace and link its output to the input of the Car Status. Now hit deploy (“Save”) in the top right corner. If you now press the left most button of the Insert node, the status data will be collected from the car. This command downloads a JSON file with a lot of useful date. But of course you cannot see this yet because we have not configured any output node.
To get a handle on the data you can connect a “Debug” node to the Car Status node. You can view the debug message if in the top right menu you select to show debug messages in the sidebar. If you click on the debug message you will see the JSON file structure.
Now for getting a useful data element out of the JSON. For instance to get the “Range” in km from the JSON you insert a “Change” node after the Car Status node and connect it to the Car Status output. Then you need to configure the “Change” node. Essentially you change the “msg.payload” which is the whole JSON file into the element you’d like to have: “msg.payload.status.engine.range” as follows:
The output of the “Change” node will now be the range of your car in km.
The data’s path may have changed, it happened to me too. You therefore need to find the right path in the json file by clicking on the relevant data point and then copy the path by clicking on the “>_” button in the column on the right in the debug window.
The next challenge is showing this data point in Home Assistant. Not knowing much about Node-Red the easiest for me was to send a MQTT message to the MQTT broker which I have already configured on my system. You can send this MQTT message by getting the “MQTT out” node into your workspace. Connect the output of the “Change” node to the input of “MQTT out”. Then configure this node, by clicking on the input field for MQTT broker. Since my broker is running on my Pi, I just filled in “localhost” with the standard “1883” port number. Under the “Security” tab include your Username and Password for the MQTT broker. Then lastly fill in the Topic for this message, that Home Assistant needs to recognise. I used: “ev/engine/range” as a topic for this data point. Do not forget to deploy your flow now and again, otherwise you will lose your input.
The last step is to configure a MQTT sensor in Home Assistant. My sensor for this data point is as follows:
- platform: mqtt name: "EV engine range" state_topic: "ev/engine/range" unit_of_measurement: "km"
Restart Home Assistant. Then if all is well, your range datapoint is defined as “sensor.ev_engine_range”. You can show this sensor in the Lovelace front end.
Now that you have the data in HA, you will want to automate this. You do this by formatting the Inject node to “Repeat” at regular intervals. I started with every five minutes. However after about 24 hours I saw the small 12 Volt battery draining itself rather quickly. I now call the data once per 24 hours, and I created a button for Lovelace to manually update the data, when I call the relevant page. But that is a different topic altogether. Willing to show what I did. Send me a message.
In the data you will also see the car’s geo coordinates. I use these coordinates to plot the car with a marker on a google maps picture. This took quite a bit of tinkering, but I did get it to work. Send me a message if anyone would like to see what I did.
So here are some screen shots of all the flows for car data:
Hi @Jan_Willem_Maas, I’d love to know more about #11, when I call the
car-location node, I get the error “Entity API error. Error Message: required key not provided @ data[‘state’]. Got None”
Any help with this would be appreciated.
Do your other Bluelinky nodes work as expected?
It seems some login info is missing You need:
- vehicle identification number
Yes, I have fully working
If I use the Car Location node in isolation (on new day, no other calls to the API yet) I also get an error message “Token not set”. When I manually start the flow again, I receive the proper information. Maybe the module does not handle the initial token it receives properly. What you can try is to call one of the other modules first to ensure the proper token is received and then call Car Location. If that does not work, better to contact the developers. I do not look “inside” the modules. I just use them in Node-Red and Home Assistant.
Thanks for trying Jan, I’ll try the Discord server at some point
Super cool. Would love to see this become an integration some day. I had been using an old android phone and tasker to lock and start my car. While it worked, it did not offer any of the integration. I’ve been using HA for more than 2 years and never found a reason to use Nodered, but this might be the push to try it out.
Thanks for sharing this Jan Willem. Helped me a lot
How did u get the car location on the map?
And why are there delays before the car odometer and the car location