From 62aa013097b2fc7a047958855d7d0d45da1b9a6e Mon Sep 17 00:00:00 2001 From: Garrett <7310260+G-Two@users.noreply.github.com> Date: Fri, 7 Oct 2022 19:54:05 -0400 Subject: [PATCH] Add vehicle model/year to subaru device (#79484) --- homeassistant/components/subaru/__init__.py | 5 +++++ homeassistant/components/subaru/const.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/homeassistant/components/subaru/__init__.py b/homeassistant/components/subaru/__init__.py index 83a5a1c1c9d..4829cf72087 100644 --- a/homeassistant/components/subaru/__init__.py +++ b/homeassistant/components/subaru/__init__.py @@ -31,6 +31,8 @@ from .const import ( VEHICLE_HAS_REMOTE_START, VEHICLE_HAS_SAFETY_SERVICE, VEHICLE_LAST_UPDATE, + VEHICLE_MODEL_NAME, + VEHICLE_MODEL_YEAR, VEHICLE_NAME, VEHICLE_VIN, ) @@ -147,6 +149,8 @@ def get_vehicle_info(controller, vin): """Obtain vehicle identifiers and capabilities.""" info = { VEHICLE_VIN: vin, + VEHICLE_MODEL_NAME: controller.get_model_name(vin), + VEHICLE_MODEL_YEAR: controller.get_model_year(vin), VEHICLE_NAME: controller.vin_to_name(vin), VEHICLE_HAS_EV: controller.get_ev_status(vin), VEHICLE_API_GEN: controller.get_api_gen(vin), @@ -163,5 +167,6 @@ def get_device_info(vehicle_info): return DeviceInfo( identifiers={(DOMAIN, vehicle_info[VEHICLE_VIN])}, manufacturer=MANUFACTURER, + model=f"{vehicle_info[VEHICLE_MODEL_YEAR]} {vehicle_info[VEHICLE_MODEL_NAME]}", name=vehicle_info[VEHICLE_NAME], ) diff --git a/homeassistant/components/subaru/const.py b/homeassistant/components/subaru/const.py index dc9a2224860..3de4930a691 100644 --- a/homeassistant/components/subaru/const.py +++ b/homeassistant/components/subaru/const.py @@ -19,6 +19,8 @@ COORDINATOR_NAME = "subaru_data" # info fields VEHICLE_VIN = "vin" +VEHICLE_MODEL_NAME = "model_name" +VEHICLE_MODEL_YEAR = "model_year" VEHICLE_NAME = "display_name" VEHICLE_HAS_EV = "is_ev" VEHICLE_API_GEN = "api_gen"