Skip to content

Commit

Permalink
Add vehicle model/year to subaru device (home-assistant#79484)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Two authored Oct 7, 2022
1 parent 5abff31 commit 62aa013
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions homeassistant/components/subaru/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
VEHICLE_HAS_REMOTE_START,
VEHICLE_HAS_SAFETY_SERVICE,
VEHICLE_LAST_UPDATE,
VEHICLE_MODEL_NAME,
VEHICLE_MODEL_YEAR,
VEHICLE_NAME,
VEHICLE_VIN,
)
Expand Down Expand Up @@ -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),
Expand All @@ -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],
)
2 changes: 2 additions & 0 deletions homeassistant/components/subaru/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

# 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"
Expand Down

0 comments on commit 62aa013

Please sign in to comment.