Hyundai Bluelink Integration

I have posted it here with debug logging enabled: "Failed setup, will retry" when adding my account. · Issue #770 · Hyundai-Kia-Connect/kia_uvo · GitHub

Hi Briadelour,
Where abouts do you add your .yaml configuration to see this card in the UI?
Many thanks,
Paul

Which Card? It’s a Vertical Stack that has a Picture-Elements followed by a Custom Stack-In-Card that has a Glance with Entities and Custom bar-card then another glance, etc, etc.

I started by creating a dashboard called Garage and from there added the cards to Lovelace. So the yaml is in the dashboard.

Here’s the updated picture-elements card by itself. I also added the ability to lock and unlock remotely along with a lock icon.

type: picture-elements
image: /local/images/ioniq6.png
elements:
  - type: state-label
    entity: sensor.2023_ioniq_6_ev_range
    style:
      color: grey
      top: 24%
      left: 11%
  - type: state-icon
    entity: sensor.2023_ioniq_6_car_battery_level
    icon: mdi:battery-50
    style:
      color: grey
      top: 9%
      left: 11%
  - type: state-label
    entity: sensor.2023_ioniq_6_ev_battery_level
    style:
      top: 9%
      left: 16%
    card_mod:
      style: |
        :host {
          color:
              {% set level = states('sensor.2023_ioniq_6_ev_battery_level')|float(0) %}
              {% if level > 80 %}
                #ffc107
              {% elif level > 20 %}
                #4caf50
              {% else %}
                #808080
              {% endif %}
  - type: state-icon
    entity: sensor.2023_ioniq_6_car_battery_level
    title: 12v
    state_color: true
    style:
      top: 5%
      left: 28%
      transform: scale(1.1, 1.1)
  - type: state-label
    entity: sensor.2023_ioniq_6_car_battery_level
    style:
      top: 11%
      left: 40%
    card_mod:
      style: |
        :host {
          color:
              {% set level = states('sensor.2023_ioniq_6_car_battery_level')|float(0) %}
              {% if level > 65 %}
                #4caf50
              {% elif level > 0 %}
                #ff5722
              {% else %}
                #808080
              {% endif %}
  - type: state-icon
    entity: binary_sensor.2023_ioniq_6_air_conditioner
    icon: mdi:air-conditioner
    title: null
    state_color: true
    style:
      left: 45%
      top: 1%
      transform: scale(1.1, 1.1)
  - type: state-label
    entity: sensor.2023_ioniq_6_odometer
    style:
      color: grey
      left: 85%
      top: 10%
  - type: state-icon
    entity: lock.2023_ioniq_6_door_lock
    style:
      color: grey
      left: 90%
      top: 20%
      transform: scale(1.1, 1.1)
  - type: state-icon
    entity: binary_sensor.2023_ioniq_6_ev_battery_plug
    state_color: true
    style:
      top: 40%
      left: 97%
  - type: state-icon
    entity: binary_sensor.2023_ioniq_6_tire_pressure_all
    style:
      top: 70%
      left: 78%
  - type: state-label
    entity: device_tracker.2023_ioniq_6_location
    style:
      color: grey
      top: 70%
      left: 26%
  - type: service-button
    title: Lock
    service: kia_uvo.lock
    service_data:
      device_id: [your_device_id]
    target: {}
    style:
      color: grey
      top: 83%
      left: 76%
  - type: service-button
    title: Unlock
    service: kia_uvo.unlock
    service_data:
      device_id:  [your_device_id]
    target: {}
    style:
      color: grey
      top: 83%
      left: 89%
  - type: service-button
    title: Start AC
    service: kia_uvo.start_climate
    service_data:
      device_id:  [your_device_id]
    target: {}
    style:
      color: grey
      top: 90%
      left: 86%
  - type: state-icon
    entity: binary_sensor.2023_ioniq_6_air_conditioner
    icon: mdi:air-conditioner
    title: null
    state_color: true
    style:
      left: 45%
      top: 1%
      transform: scale(1.1, 1.1)
  - type: state-label
    entity: sensor.2023_ioniq_6_last_updated_at
    show_last_changed: true
    style:
      top: 86%
      left: 36%
      color: grey
  - type: service-button
    title: Update
    service: kia_uvo.update
    service_data:
      device_id:  [your_device_id]
    target: {}
    style:
      color: grey
      top: 92%
      left: 22%

You can do it with a template sensor, i’ve done it for my peugeot

        - name: "voiture_g_e208_energie_type_charge"
          unique_id: 'voiture_g_e208_energie_type_charge'
          state: >
            {% if (state_attr('sensor.voiture_g_e208_capteur_energie','charging')|d({}, true)).get('charging_mode', 'No') == 'CCS' %}
              DC
            {% elif (state_attr('sensor.voiture_g_e208_capteur_energie','charging')|d({}, true)).get('charging_mode', 'No') == 'Slow' %}
              AC
            {% else %}
              off
            {% endif %}
          icon: >
            {% if (state_attr('sensor.voiture_g_e208_capteur_energie','charging')|d({}, true)).get('charging_mode', 'No') == 'CCS' %}
              mdi:ev-plug-ccs2
            {% elif (state_attr('sensor.voiture_g_e208_capteur_energie','charging')|d({}, true)).get('charging_mode', 'No') == 'Slow' or is_state("binary_sensor.voiture_g_e208_energie_brancher", "on") %}
              mdi:ev-plug-type2
            {% else %}
              mdi:connection
            {% endif %}

I also added this to the picture-elements to make it blink the same colors as the led on the car

type: picture-elements
style: |
  ha-card {
    --charging-state-animation:{% if is_state('sensor.voiture_g_e208_energie_etat_charge','InProgress') or is_state('sensor.voiture_g_e208_energie_etat_charge','Error') %} blink 3s linear infinite {% else %} none {% endif %};
    --charging-state-color:{% if is_state('sensor.voiture_g_e208_energie_etat_charge','Disconnected')%} white {% elif is_state('sensor.voiture_g_e208_energie_etat_charge', 'Stopped')%} #00aff0 {% elif is_state('sensor.voiture_g_e208_energie_etat_charge', 'Error')%} red {% else %} #43d854 {% endif %};
    --charger-state-color:{% if is_state('script.garage_voiture_e208_g_chargeur_16a_verification_capacite_electrique','on')%} #00aff0 {% elif is_state('switch.chargeur_16a_ev', 'on') %} var(--paper-item-icon-active-color) {% else %} white {% endif %}
  }
  @keyframes blink {            
    75% {opacity: 0.3;}
  }
...
  - type: state-icon
    entity: sensor.voiture_g_e208_energie_type_charge
    title: Charging State
    style:
      top: 24%
      left: 96%
      '--paper-item-icon-color': var(--charging-state-color)
      animation: var(--charging-state-animation)

1 Like

I see what you did with the binary sensor. Very cool. Not sure how I can use the blink but this was very helpful.

@Vaarlion thanks for the suggestion!

image

image

I was able to get the icons to change color based on the styling conditions.

I even added the Hyundai “morse code” SOC indicator. If you drive an Ioniq you know :slight_smile:

type: picture-elements
style: |
  ha-card {
    --charge-ev-optimal-range: {% if states('sensor.2023_ioniq_6_ev_battery_level')|float > 20 %} green {% else %} red {% endif %};
    --charge-12v-optimal-range: {% if states('sensor.2023_ioniq_6_car_battery_level')|float > 65 %} green {% else %} red {% endif %};
    --charge-1: {% if states('sensor.2023_ioniq_6_ev_battery_level')|float > 1 %} white {% else %} grey {% endif %};
    --charge-2: {% if states('sensor.2023_ioniq_6_ev_battery_level')|float > 24 %} white {% else %} grey {% endif %};
    --charge-3: {% if states('sensor.2023_ioniq_6_ev_battery_level')|float > 49 %} white {% else %} grey {% endif %};
    --charge-4: {% if states('sensor.2023_ioniq_6_ev_battery_level')|float > 74 %} white {% else %} grey {% endif %};
  }
image: /local/images/ioniq6.png
elements:
  - type: state-label
    entity: sensor.2023_ioniq_6_ev_range
    style:
      color: grey
      top: 24%
      left: 11%
  - type: state-icon
    entity: sensor.2023_ioniq_6_car_battery_level
    icon: mdi:battery-50
    style:
      color: grey
      top: 9%
      left: 11%
      transform: scale (1,1)
      '--paper-item-icon-color': var(--charge-ev-optimal-range)
  - type: state-label
    entity: sensor.2023_ioniq_6_ev_battery_level
    style:
      color: grey
      top: 9%
      left: 17%
  - type: state-icon
    entity: sensor.2023_ioniq_6_car_battery_level
    title: 12v
    state_color: false
    style:
      top: 5%
      left: 28%
      transform: scale(1.1, 1.1)
      '--paper-item-icon-color': var(--charge-12v-optimal-range)
  - type: state-label
    entity: sensor.2023_ioniq_6_car_battery_level
    state_color: false
    style:
      color: grey
      top: 11%
      left: 40%
  - type: state-icon
    entity: binary_sensor.2023_ioniq_6_air_conditioner
    icon: mdi:air-conditioner
    title: null
    state_color: true
    style:
      left: 45%
      top: 1%
      transform: scale(1.1, 1.1)
  - type: state-label
    entity: sensor.2023_ioniq_6_odometer
    style:
      color: grey
      left: 85%
      top: 10%
  - type: state-icon
    entity: lock.2023_ioniq_6_door_lock
    state_color: true
    style:
      left: 90%
      top: 20%
      transform: scale(1.1, 1.1)
  - type: state-icon
    entity: binary_sensor.2023_ioniq_6_ev_battery_plug
    state_color: true
    style:
      top: 40%
      left: 97%
  - type: state-icon
    entity: binary_sensor.2023_ioniq_6_tire_pressure_all
    style:
      top: 70%
      left: 78%
  - type: service-button
    title: Lock
    service: kia_uvo.lock
    service_data:
      device_id: [your_device_id]
    target: {}
    style:
      color: grey
      top: 83%
      left: 78%
  - type: service-button
    title: / Unlock
    service: kia_uvo.unlock
    service_data:
      device_id: [your_device_id]
    target: {}
    style:
      color: grey
      top: 83%
      left: 89%
  - type: service-button
    title: Start AC
    service: kia_uvo.start_climate
    service_data:
      device_id: [your_device_id]
    target: {}
    style:
      color: grey
      top: 90%
      left: 86%
  - type: state-icon
    icon: mdi:square
    entity: sensor.2023_ioniq_6_ev_battery_level
    state_color: false
    style:
      top: 90%
      left: 50%
      width: 40px
      height: 40px
      transform: scale(.5,.5)
      '--paper-item-icon-color': var(--charge-1)
  - type: state-icon
    icon: mdi:square
    entity: sensor.2023_ioniq_6_ev_battery_level
    state_color: false
    style:
      top: 90%
      left: 55%
      width: 40px
      height: 40px
      transform: scale(.5,.5)
      '--paper-item-icon-color': var(--charge-2)
  - type: state-icon
    icon: mdi:square
    entity: sensor.2023_ioniq_6_ev_battery_level
    state_color: false
    style:
      top: 90%
      left: 60%
      width: 40px
      height: 40px
      transform: scale(.5,.5)
      '--paper-item-icon-color': var(--charge-3)
  - type: state-icon
    icon: mdi:square
    entity: sensor.2023_ioniq_6_ev_battery_level
    state_color: false
    style:
      top: 90%
      left: 65%
      width: 40px
      height: 40px
      transform: scale(.5,.5)
      '--paper-item-icon-color': var(--charge-4)
  - type: state-label
    entity: sensor.2023_ioniq_6_last_updated_at
    show_last_changed: true
    style:
      top: 86%
      left: 36%
      color: grey
  - type: service-button
    title: Update
    service: kia_uvo.update
    service_data:
      device_id: [your_device_id]
    target: {}
    style:
      color: grey
      top: 92%
      left: 22%
  - type: state-label
    entity: device_tracker.2023_ioniq_6_location
    style:
      color: grey
      top: 70%
      left: 26%

Hi,

is there someone with Tucson HEV? Can you share yaml? :slight_smile:

THX

Yes i have a hyundai tucson phev , so happy to test the integration if with the current (beta) version the dialy driving stats are working or not … it shown in the public version but sofar not working…

Hi all!

We live in a condo where my car (MachE) is in the 2nd basement.
I had a scare where my wife’s battery (the 12V one, Ioniq5) went dead and had to boost it. Also 2nd basement.

We both had Fordpass & Hyndai integrations (now disabled).

I wonder if the polling is not extensive (concrete, 2nd floor, etc.) and may have caused this working overtime to “reach” the car. Who knows.

===============================

QUESTION

How can I (dynamically) change or enable polling only when X happens (Android auto is on, for example). I cannot find the “POLLING” entity to either change it dynamically or simply just enable/disable it.

Can the developper add this feature ?
That would be an easy one (but then again I’m not coding it…) - I think (!?)

Has someone tried this ? Or similar.

Thanks for any help!

Don’t know about the MachE!

In the Hyundai/KIA integration you can configure the the

  • Scan Intervall (i.e. how often the integration updates its status from the Hyundai Server)
  • the Force Refresh Intervall (i.e. how often is the car woken up to report its status to the server.

The scan intervall has zero effect on the 12V, because it gets the data from the server, not from the car.

If you set the Force Refresh to let’s say 1380 minutes (i.e. 23 hours) it will wake up the car only once per day - so no problem with 12V drain.

I have mine set to 240min (i.e. 4 hours) and never had a problem with the 12V.

You can do a manual force refresh - or an automatic one of your liking - through an automation at any time - so the feature you are asking for already exists.

Hi Frank,

Thanks for your answer.

I checked before posting and I cannot find any entity for either interval settings. I know I can change the settings manually but can’t find any settings to do it in an automation. What do you have that you are able to set?

Thanks, any help is appreciated!

You have to change the settings in the integration itself.
Go to:

  • Settings
  • Integrations
  • Hyundai/Kia Connect
  • Configure

and then you should see this:

Whatever you set up there will happen automatically in the background.

If you want to do an additional update or a refresh in an automation, you have to call the respective service:

  • update from server: kia_uvo.update
  • wake up car and refresh: kia_uvo.force_update

To see all the services that are available for this integration, go to

  • developer tools
  • select Services
  • type: KIA
1 Like

You just opened up a solution to my idea.

The integration is not my route as I want to do it dynamically when the car is plugged in to Android auto.

Your second option is likely all I need. I didn’t know about those services. Sounds perfect.

Thanks a bunch, Frank! :beers:

1 Like

Hi folks, I’ve only recently started using Home Assistant for the first time and have now successfully installed this plugin via HACS. I’m amazed at some of the designs you folk have come up with and I’d very much like to try them.

Is there a noob guide you can recommend to customise the dashboard like some of the screenshots you’ve been adding here? Perhaps I am doing something wrong, but the only option I have with my 38kWh Ioniq is to unlock the doors and even that doesn’t work. Did I see a ‘Force Unlock’ option somewhere? Thank you!

if i want to set updates 24/7 then i should set these two blue bars to 0, correct?

i dont need update every minute, hopefully 60 mins is good enough
image

assuming i get update on the hour such as 2, 3, 4am. BUT someone opened the door at 4:10am, would i get an alert at 4:10am? or would i get at the next update at 5am? (assuming door is still opened at 5am)

also, i see my 12v batt is going down. at what percentage would the 600v batt kick in? and when it does, which entity will show up as “On?”

my last update was from 4hours ago
image

so now im curious, what’s the difference between scan and forced interval?

The difference between a Scan and a Forced Refresh lies in the source of the data.

If you do a Scan you are merely contacting the Hyundai Server and get the latest saved data from there - no harm done to the car ( I have mine set to 30 min btw).

If you do a Forced Refresh, than you are waking up the car and get the actual status at that moment - if you do that too often, you are potentially draining your 12V, and also Bluelink may restrict you from further refreshs.

A forced refresh only makes sense in a few situations - so if I were you, I would stick with Scans and set the Forced Refresh to something like 4-6hours or so.

To answer your question with the door (at 4:10):
When the door opens (at 04:10), it should update the status of the car on the server (within a minute or so) - if that status does not change, you will get that info when you do the next scan (in your case on the hour) at 05:00.

Very rarely does a refresh make much sense, but if you do want to make a manual Refresh because of a specific reason, put a button on your dashboard that calls the service kia_uvo.force_update.

"…also, i see my 12v batt is going down. at what percentage would the 600v batt kick in? and when it does, which entity will show up as “On?..”

The answer to that is — never – :slight_smile: I think ?!?
At least in my case, the 12V battery status update happens at completely random intervalls.
In my case it never updates when the car is sitting still in the parking lot - even if I do a forced refresh.

So I believe that HA is not the right tool to monitor the 12V status - other than give you a basic idea about the health status of the 12V in general.
My 12V started out in the high 90s - after 2.5 years of use I rarely see more then 85% these days.

@Frank_Beetz
that was very informative. thank you!
i followed your advice at set the minutes accordingly.

i live in a bad neighborhood, so i still want Force Refresh throughout the night (4hours interval) so hopefully these settings work:

1 Like

Starting from yesterday, I lost my entities (all looks unavailable).
I have tried to reload the integration, reboot HA, etc.
I have removed the integration and tried to add it again but I have the below error:

Any ideea what is happening?

Also, when I try to login it is asking me for a PIN, what is that PIN about? My Bluekink app is not asking for anything like this. Where I can find it?

If I put a random numebre or no number at all, I have the same issue.

Bluelink app is ok, no issue. I have tried with another account (one of my friends), same error

2024-04-04 05:57:09.833 DEBUG (SyncWorker_15) [hyundai_kia_connect_api.KiaUvoApiEU] hyundai_kia_connect_api - Get Vehicles Response: {‘retCode’: ‘F’, ‘resCode’: ‘4017’, ‘resMsg’: ‘Invalid request value - Invalid Application Id. - 3596.0859999656677’, ‘msgId’: ‘aeb5be48-8ec0-4b8f-ae3b-7ffbee0b2e49’}
2024-04-04 05:57:09.834 ERROR (MainThread) [custom_components.kia_uvo.coordinator] Unexpected error fetching kia_uvo data: Server returned: ‘4017’ ‘Invalid request value - Invalid Application Id. - 3596.0859999656677’
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 290, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/kia_uvo/coordinator.py”, line 107, in _async_update_data
await self.async_check_and_refresh_token()
File “/config/custom_components/kia_uvo/coordinator.py”, line 166, in async_check_and_refresh_token
await self.hass.async_add_executor_job(
File “/usr/local/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py”, line 125, in check_and_refresh_token
self.initialize()
File “/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py”, line 71, in initialize
vehicles = self.api.get_vehicles(self.token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py”, line 271, in get_vehicles
_check_response_for_errors(response)
File “/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py”, line 127, in _check_response_for_errors
raise APIError(
hyundai_kia_connect_api.exceptions.APIError: Server returned: ‘4017’ ‘Invalid request value - Invalid Application Id. - 3596.0859999656677’
2024-04-04 05:57:09.842 DEBUG (MainThread) [custom_components.kia_uvo.coordinator] Finished fetching kia_uvo data in 2.628 seconds (success: False)