Files
core/homeassistant/components/subaru/const.py
T
Garrett 9058b5b9c3 Update sensors for Subaru integration (#66996)
* Update sensor.py

* Change "EV Time to Fully Charged" type to datetime object (HA 2022.2)

* Validate types before accessing dict entries

* Test handling of invalid data from Subaru

* Bump to subarulink 0.4.2

* Incorporate style suggestion

* Update sensor.py to use SensorEntity

* isort tests

* Remove SubaruSensor.current_value

* Fix isort errors

* Resolve conflict from previous PR (add locks)

* Fix linting errors in config_flow.py

* Incorporate PR review comments for sensor

* Incorporate PR review comments for sensor

* Make 3rd party library responsible for API data parsing

* Add type annotations to sensor.py

* Incorporate PR review comments

* Incorporate PR review comments

* Set _attr_has_entity_name = True for sensors
2022-10-02 00:25:49 +02:00

62 lines
1.3 KiB
Python

"""Constants for the Subaru integration."""
from subarulink.const import ALL_DOORS, DRIVERS_DOOR, TAILGATE_DOOR
from homeassistant.const import Platform
DOMAIN = "subaru"
FETCH_INTERVAL = 300
UPDATE_INTERVAL = 7200
CONF_UPDATE_ENABLED = "update_enabled"
CONF_COUNTRY = "country"
# entry fields
ENTRY_CONTROLLER = "controller"
ENTRY_COORDINATOR = "coordinator"
ENTRY_VEHICLES = "vehicles"
# update coordinator name
COORDINATOR_NAME = "subaru_data"
# info fields
VEHICLE_VIN = "vin"
VEHICLE_NAME = "display_name"
VEHICLE_HAS_EV = "is_ev"
VEHICLE_API_GEN = "api_gen"
VEHICLE_HAS_REMOTE_START = "has_res"
VEHICLE_HAS_REMOTE_SERVICE = "has_remote"
VEHICLE_HAS_SAFETY_SERVICE = "has_safety"
VEHICLE_LAST_UPDATE = "last_update"
VEHICLE_STATUS = "status"
API_GEN_1 = "g1"
API_GEN_2 = "g2"
MANUFACTURER = "Subaru"
PLATFORMS = [
Platform.LOCK,
Platform.SENSOR,
]
SERVICE_LOCK = "lock"
SERVICE_UNLOCK = "unlock"
SERVICE_UNLOCK_SPECIFIC_DOOR = "unlock_specific_door"
ATTR_DOOR = "door"
UNLOCK_DOOR_ALL = "all"
UNLOCK_DOOR_DRIVERS = "driver"
UNLOCK_DOOR_TAILGATE = "tailgate"
UNLOCK_VALID_DOORS = {
UNLOCK_DOOR_ALL: ALL_DOORS,
UNLOCK_DOOR_DRIVERS: DRIVERS_DOOR,
UNLOCK_DOOR_TAILGATE: TAILGATE_DOOR,
}
ICONS = {
"Avg Fuel Consumption": "mdi:leaf",
"EV Range": "mdi:ev-station",
"Odometer": "mdi:road-variant",
"Range": "mdi:gas-station",
}