G-Two / homeassistant-subaru

Subaru STARLINK custom component for Home Assistant.
Apache License 2.0
56 stars 8 forks source link
custom-component homeassistant subaru

Subaru STARLINK Integration for Home Assistant

hacs_badge

[!NOTE] The Subaru integration is now part of Home Assistant Core (as of release 2021.3), however not all features have been implemented. Currently, only the device tracker, sensor, and lock platforms are available. Additional PRs will be submitted to include all features of this custom component into Home Assistant Core. Users that desire full functionality should continue to use this custom component until all functionality is merged into Home Assistant Core. When installed, this custom component overrides the Home Assistant Core built-in Subaru integration.


Description

This Home Assistant custom component retrieves vehicle information and actuates remote services provided by Subaru STARLINK (currently only available in USA and Canada).

This integration requires a telematics equipped Subaru and an active vehicle subscription to the Subaru STARLINK service. Before using this integration, you must first register and have login credentials to MySubaru.

Subaru has deployed three generations of STARLINK telematics. Use the table below to determine which generation your vehicle is. This table is a best guess based upon what Subaru lists as available features.

Model Gen 1 Gen 2 Gen 3
Ascent --- 2019-2023 2024+
BRZ --- 2022-2023 ---
Crosstrek 2016-2018 2019+ ---
Forester 2016-2018 2019+ ---
Impreza 2016-2018 2019-2022 2023+
Legacy 2016-2019 2020-2022 2023+
Outback 2016-2019 2020-2022 2023+
WRX 2017-2021 2022-2023 ---

Sensors

Sensor Gen 1 Gen 2 Gen 3
Average fuel consumption
Distance to empty
EV battery level ?
EV range ?
EV time to full charge ?
Odometer ✓*
Tire pressures

* Gen 1 odometer only updates every 500 miles

Binary Sensors

Binary Sensor Gen 1 Gen 2 Gen 3
Door/Trunk/Hood Status
Window Status ✓*
Ignition Status
EV Plug/Charging Status ✓* ?

* Not supported by all vehicles

Device Tracker

Device tracker, lock, and buttons (except refresh) all require a STARLINK Security Plus subscription: Device Tracker Gen 1 Gen 2 Gen 3
Vehicle Location

Lock

Lock Gen 1 Gen 2 Gen 3
Remote lock/unlock

This integration supports remote locking and unlocking of vehicle doors. If doors are remotely unlocked, they will automatically relock if a door is not opened within a minute. There is no remote notification of this automatic relock.

[!NOTE] The actual lock status is always unknown due to the fact that the Subaru API does not report this data.

Buttons

Buttons Gen 1 Gen 2 Gen 3
Start/Stop Horn/Lights
Poll vehicle
Refresh data
Start/Stop Horn/Lights
Start/Stop Engine ✓* ✓*
Start EV charging ✓* ?

* Not supported by all vehicles

Installation

HACS

Add https://github.com/G-Two/homeassistant-subaru as a custom integration repository and install the Subaru (HACS) integration. Restart Home Assistant.

Manual

Clone or download this repository, and copy the custom_components/subaru directory into the config/custom_components directory of your Home Assistant instance. Restart Home Assistant.

Configuration

Once installed, the Subaru integration is configured via the Home Assistant UI:

Configuration -> Devices & Services -> Add Integration -> Subaru (HACS)

[!IMPORTANT] After installation and HA restart, you may need to clear your browser cache for the new integration to appear.

When prompted, enter the following configuration parameters:

After your account is authenticated, you will need to authorize the application with Subaru's two factor authentication. Follow the prompts to select a phone number or email address to receive a verification code and enter when prompted. This should only need to be accomplished during initial configuration.

After successful authorization, if a supported remote services vehicle with active subscription is found in your account, an additional prompt will appear:

[!IMPORTANT] If your account includes multiple vehicles, the same PIN will be used for all vehicles. Ensure that you have configured all vehicles in your account to have the same PIN.

If the PIN prompt does not appear, no supported remote services vehicles were found in your account. Limited vehicle data may still appear as sensors.

Options

Subaru integration options are set via:

Configuration -> Devices & Services -> Subaru (HACS) -> Configure.

All options involve remote commands, thus only apply to vehicles with Security Plus subscriptions:

Services

The following Subaru entities use built-in Home Assistant services:

The Lock entity's "Unlock" will unlock all doors. The Subaru API supports selecting a specific door to unlock. Users that wish to use this functionality may call an integration specific service which allows the user to choose the door to unlock. See the Services UI in Developer Tools for usage. Example YAML for this service is:

service: subaru.unlock_specific_door
target:
  entity_id: lock.subaru_door_locks
data:
  # Valid values for door are 'all', 'driver', 'tailgate' (note that 'tailgate' is not supported by all vehicles)
  door: driver

Events

subaru_command_sent

This event is fired when a command is called.

Field Description
command The command that was called. See Command list
car_name The name of the vehicle

subaru_command_successful

This event is fired when a command is successful.

Field Description
command The command that was called. See Command list
car_name The name of the vehicle

subaru_command_failed

This event is fired when a command fails.

Field Description
command The command that was called. See Command list
car_name The name of the vehicle
message The message returned from the failed command

Command List

This is a list of possible commands for the above events.

fetch, update, lock, unlock, lights, lights_stop, horn, horn_stop, remote_start, remote_stop, charge_start, preset_name