kia_uvo
kia_uvo copied to clipboard
feat: EV sensors for average consumption & energy used
This PR adds two sensors for EV's:
- Average Energy Consumption (30 day moving average)
- Total Energy Consumption
The average shows in watt per kilometer (mile) the average usage of the past 30 days. The total consumption shows in kwh the total energy consumption since the vehicle was connected to Bluelink. This sensor can be used in conjuction with the Home Assistant Energy dashboard as an individual device, allowing one to see daily, weekly, monthly statistics. The sensor also includes as attributes other information such as recuperation energy and climate usage (in watt).
This code has been running for more than a month now in my setup.
There are three considerations:
- Only tested in EU
- Only tested with EV. Not sure if the same / comparable api is available for fuel cars
- It requires two additional api calls. This counts towards the api limit. In my current setup this hasn't been an issue (6 min scan interval / 780 min force update / no black blackout). It is best to only make this call when doing a force update, however I've been unable to figure out to code this in a manageable way. Suggestions are welcome.
Could we have a few people test this out? My only worry would be calling it each refresh may impact total API calls. It seems like something we should only call if mileage has changed.
It does impact the total API calls indeed. But as mentioned, my setup is 6 min scan interval + 13 hours force update + no blackout. These settings give me no issues with API limits.
I identified an issue with this sensor last week. The total consumption is only the sum of the last 92 days. So I need to rework this to a monthly sensor and utilise the last_reset attribute.
Sounds great Looking forward to it being implemented š
I'm eagerly waiting for this to be merged... I have set up a dashboard in Grafana (using InfluxDB) and have odometer metric and some battery metrics for my E-Niro. However would really like to be able to correlate this with energy used so I can get e.g. a monthly average. :)
Since the API only returned the last 92 days, the sensor for total consumption wasn't working as expected. A moving total sum was returned, and the sensor was therefore able to decrease as well.
I'm now testing a monthly sensor, which should reset to 0 every month. However, I'm unsure whether the sensor entity should have the attribute 'last_reset' or not: I don't think it is necessary.
The monthly sensor works perfect. The sensor now energy consumption sensor now only includes this month's usage. It resets on your first drive of the month (limitation of the API).
HA long term stats continues to accumulate after the reset and shows the all time total usage. The sensor is shown as expected in the HA energy dashboard.
I'd say it is good to go
It does impact the total API calls indeed. But as mentioned, my setup is 6 min scan interval + 13 hours force update + no blackout. These settings give me no issues with API limits.
13h forced update seems oddly specific and not the default 4h - what's your logic there? I'm hoping to learn from it.
It does impact the total API calls indeed. But as mentioned, my setup is 6 min scan interval + 13 hours force update + no blackout. These settings give me no issues with API limits.
13h forced update seems oddly specific and not the default 4h - what's your logic there? I'm hoping to learn from it.
In my opinion, force updates are not really necessary. Typically the car will connect to BlueLink if it has relevant data. Therefore, my scan interval is several minutes. But to be sure, the force update occurs always once a day, but never at the same time.
In my opinion, force updates are not really necessary. Typically the car will connect to BlueLink if it has relevant data. Therefore, my scan interval is several minutes. But to be sure, the force update occurs always once a day, but never at the same time.
Ahh interesting strategy, I like that! Iām experimenting with 0 forced updates right now because every 4 hours definitely prevents the car from going into deep sleep, and my aux battery saver + has stopped working, so under the constant 3W drain, my car needs a jump after 3 days or so idle. But the maximum setting available seems to be 999 minutes.
Hi all,
After reading the release notes I noticed that 2 sensor's should have been added but I can only see the "Average Energy Consumption" one, "Total Energy Consumption" isn't showing up, not after reloading the integration or reconfiguring it.
Could someone please point me in the right direction what I should try next?
Thanks for the work!
edit: Car is a Ioniq 5. (EU based - Belgium)
Look for Monthly energy consumption (Love the car!!)
Before I upset my API that just started giving me car battery measurements again - is this update only tested in EU or is it definitely not applicable in other markets?
Look for Monthly energy consumption (Love the car!!)
Right, got it... Should have just opened the energy dashboard and looked in that list as it only shows fields that can be used in the dashboard...
I was looking at the sensors in the integration and focused to much on this screenshot
Thanks again and kuddos for the people maintaining this!
@rsegers - can we agree that you did NOT add a sensor showing the total amount of kW used from day 1 the car was added to bluelink? We have monthly usage & average consumption ( I do not know if this is average since day 1 of bluelink )
@rsegers - can we agree that you did NOT add a sensor showing the total amount of kW used from day 1 the car was added to bluelink? We have monthly usage & average consumption ( I do not know if this is average since day 1 of bluelink )
Yes, that is correct. BlueLink does not provide a total metric. However, the monthly sensor is configured in HA as a statistic and will thus calculate a total amount from the current month onwards for this sensor.
Before I upset my API that just started giving me car battery measurements again - is this update only tested in EU or is it definitely not applicable in other markets?
I have only tested it in EU. You can of course always donate me a US car š
for Average Energy Consumption (30 day moving average)
you can do the following to get km pr. kwh same calculation for mi pr. kwh
note: sensor.ioniq_5_average_energy_consumption is MY sensorname - change it to match yours!
- platform: template sensors: ioniq_km_kwh: friendly_name: Ioniq - Km pr Kwh value_template: "{{ (1 / (states('sensor.ioniq_5_average_energy_consumption') | float / 1000)) | round(2) }}"
Github doesn't add code well ..
- platform: template sensors: ioniq_km_kwh: friendly_name: Ioniq - Km pr Kwh value_template: "{{ (1 / (states('sensor.ioniq_5_average_energy_consumption') | float / 1000)) | round(2) }}"