From 639796b370c7fa3216845a1ed980405e007dcfc0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 18:43:13 -0600 Subject: [PATCH 1/6] chore: pre-commit autoupdate (#950) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea2ffbd0..877b0531 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ ci: autoupdate_commit_msg: "chore: pre-commit autoupdate" repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.9 + rev: v0.7.0 hooks: - id: ruff args: @@ -55,7 +55,7 @@ repos: - --keep-updates files: ^(/.+)?[^/]+\.py$ - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.2 + rev: v1.12.1 hooks: - id: mypy args: [--strict, --ignore-missing-imports] From 686baa91217d805d98729f27c4573292d7d3a7b6 Mon Sep 17 00:00:00 2001 From: MichaelMKKelly <100048727+MichaelMKKelly@users.noreply.github.com> Date: Sun, 27 Oct 2024 14:41:45 +0000 Subject: [PATCH 2/6] feat: Add Sensor for todays daily stats (#954) --- custom_components/kia_uvo/sensor.py | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/custom_components/kia_uvo/sensor.py b/custom_components/kia_uvo/sensor.py index 10734340..945803be 100644 --- a/custom_components/kia_uvo/sensor.py +++ b/custom_components/kia_uvo/sensor.py @@ -4,6 +4,7 @@ import logging from typing import Final +from datetime import date from hyundai_kia_connect_api import Vehicle @@ -270,6 +271,11 @@ async def async_setup_entry( coordinator, coordinator.vehicle_manager.vehicles[vehicle_id] ) ) + entities.append( + TodaysDailyDrivingStatsEntity( + coordinator, coordinator.vehicle_manager.vehicles[vehicle_id] + ) + ) entities.append( VehicleEntity(coordinator, coordinator.vehicle_manager.vehicles[vehicle_id]) ) @@ -381,3 +387,53 @@ def unique_id(self): @property def unit_of_measurement(self): return UnitOfTime.DAYS + + +class TodaysDailyDrivingStatsEntity(SensorEntity, HyundaiKiaConnectEntity): + def __init__(self, coordinator, vehicle: Vehicle): + super().__init__(coordinator, vehicle) + + @property + def state(self): + today = date.today() + todayskey = today.strftime("%Y-%m-%d") + return todayskey + + @property + def state_attributes(self): + today = date.today() + todayskey = today.strftime("%Y-%m-%d") + m = { + "today_date": todayskey, + "total_consumed": 0, + "engine_consumption": 0, + "climate_consumption": 0, + "onboard_electronics_consumption": 0, + "battery_care_consumption": 0, + "regenerated_energy": 0, + "distance": 0, + } + for day in self.vehicle.daily_stats: + key = day.date.strftime("%Y-%m-%d") + if key == todayskey: + todayvalue = { + "today_date": key, + "total_consumed": day.total_consumed, + "engine_consumption": day.engine_consumption, + "climate_consumption": day.climate_consumption, + "onboard_electronics_consumption": day.onboard_electronics_consumption, + "battery_care_consumption": day.battery_care_consumption, + "regenerated_energy": day.regenerated_energy, + "distance": day.distance, + } + m = todayvalue + break + return m + + @property + def name(self): + return f"{self.vehicle.name} Todays Daily Driving Stats" + + @property + def unique_id(self): + return f"{DOMAIN}-todays-daily-driving-stats-{self.vehicle.id}" From 66c8bebc7ad5cd830425f71b8c23fa23bddda57e Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 30 Oct 2024 08:23:28 +0000 Subject: [PATCH 3/6] chore: bumping version to 2.28.0 --- custom_components/kia_uvo/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/kia_uvo/manifest.json b/custom_components/kia_uvo/manifest.json index a6240a73..992e739f 100644 --- a/custom_components/kia_uvo/manifest.json +++ b/custom_components/kia_uvo/manifest.json @@ -9,5 +9,5 @@ "issue_tracker": "https://github.com/Hyundai-Kia-Connect/kia_uvo/issues", "loggers": ["kia_uvo", "hyundai_kia_connect_api"], "requirements": ["hyundai_kia_connect_api==3.23.8"], - "version": "2.27.2" + "version": "2.28.0" } From 5ad7d401ec0d228be06aea27d8c3cb338e5234e6 Mon Sep 17 00:00:00 2001 From: cdnninja Date: Wed, 30 Oct 2024 12:11:36 -0600 Subject: [PATCH 4/6] fix: API bump --- custom_components/kia_uvo/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/kia_uvo/manifest.json b/custom_components/kia_uvo/manifest.json index 992e739f..54138c05 100644 --- a/custom_components/kia_uvo/manifest.json +++ b/custom_components/kia_uvo/manifest.json @@ -8,6 +8,6 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/Hyundai-Kia-Connect/kia_uvo/issues", "loggers": ["kia_uvo", "hyundai_kia_connect_api"], - "requirements": ["hyundai_kia_connect_api==3.23.8"], + "requirements": ["hyundai_kia_connect_api==3.24.0"], "version": "2.28.0" } From 329244b5e8224e40339fb6b0fb513420c500c68b Mon Sep 17 00:00:00 2001 From: cdnninja Date: Wed, 30 Oct 2024 18:33:53 -0600 Subject: [PATCH 5/6] fix(AU): error related to loading and drive info --- custom_components/kia_uvo/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/kia_uvo/manifest.json b/custom_components/kia_uvo/manifest.json index 54138c05..57029e14 100644 --- a/custom_components/kia_uvo/manifest.json +++ b/custom_components/kia_uvo/manifest.json @@ -8,6 +8,6 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/Hyundai-Kia-Connect/kia_uvo/issues", "loggers": ["kia_uvo", "hyundai_kia_connect_api"], - "requirements": ["hyundai_kia_connect_api==3.24.0"], + "requirements": ["hyundai_kia_connect_api==3.24.1"], "version": "2.28.0" } From be1037d9ce64a5e06394f7f94e65c9fd2918b7de Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 31 Oct 2024 00:34:51 +0000 Subject: [PATCH 6/6] chore: bumping version to 2.28.1 --- custom_components/kia_uvo/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/kia_uvo/manifest.json b/custom_components/kia_uvo/manifest.json index 57029e14..f699bf03 100644 --- a/custom_components/kia_uvo/manifest.json +++ b/custom_components/kia_uvo/manifest.json @@ -9,5 +9,5 @@ "issue_tracker": "https://github.com/Hyundai-Kia-Connect/kia_uvo/issues", "loggers": ["kia_uvo", "hyundai_kia_connect_api"], "requirements": ["hyundai_kia_connect_api==3.24.1"], - "version": "2.28.0" + "version": "2.28.1" }