Use core constants for nissan_leaf (#46401)

This commit is contained in:
tkdrob 2021-02-11 11:44:39 -05:00 committed by GitHub
parent ed31cc363b
commit c95f401e2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ import sys
from pycarwings2 import CarwingsError, Session from pycarwings2 import CarwingsError, Session
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, HTTP_OK from homeassistant.const import CONF_PASSWORD, CONF_REGION, CONF_USERNAME, HTTP_OK
from homeassistant.core import callback from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import load_platform from homeassistant.helpers.discovery import load_platform
@ -34,7 +34,6 @@ DATA_RANGE_AC_OFF = "range_ac_off"
CONF_INTERVAL = "update_interval" CONF_INTERVAL = "update_interval"
CONF_CHARGING_INTERVAL = "update_interval_charging" CONF_CHARGING_INTERVAL = "update_interval_charging"
CONF_CLIMATE_INTERVAL = "update_interval_climate" CONF_CLIMATE_INTERVAL = "update_interval_climate"
CONF_REGION = "region"
CONF_VALID_REGIONS = ["NNA", "NE", "NCI", "NMA", "NML"] CONF_VALID_REGIONS = ["NNA", "NE", "NCI", "NMA", "NML"]
CONF_FORCE_MILES = "force_miles" CONF_FORCE_MILES = "force_miles"
@ -272,7 +271,6 @@ class LeafDataStore:
async def async_refresh_data(self, now): async def async_refresh_data(self, now):
"""Refresh the leaf data and update the datastore.""" """Refresh the leaf data and update the datastore."""
if self.request_in_progress: if self.request_in_progress:
_LOGGER.debug("Refresh currently in progress for %s", self.leaf.nickname) _LOGGER.debug("Refresh currently in progress for %s", self.leaf.nickname)
return return
@ -336,7 +334,6 @@ class LeafDataStore:
async def async_get_battery(self): async def async_get_battery(self):
"""Request battery update from Nissan servers.""" """Request battery update from Nissan servers."""
try: try:
# Request battery update from the car # Request battery update from the car
_LOGGER.debug("Requesting battery update, %s", self.leaf.vin) _LOGGER.debug("Requesting battery update, %s", self.leaf.vin)
@ -388,7 +385,6 @@ class LeafDataStore:
async def async_get_climate(self): async def async_get_climate(self):
"""Request climate data from Nissan servers.""" """Request climate data from Nissan servers."""
try: try:
return await self.hass.async_add_executor_job( return await self.hass.async_add_executor_job(
self.leaf.get_latest_hvac_status self.leaf.get_latest_hvac_status