mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Make _LOGGER public in ecobee (#177356)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
co-authored by
Joost Lekkerkerker
parent
4ea24da95b
commit
cefb40e2d2
@@ -26,7 +26,7 @@ from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from .const import _LOGGER, CONF_REFRESH_TOKEN, DOMAIN, PLATFORMS
|
||||
from .const import CONF_REFRESH_TOKEN, DOMAIN, LOGGER, PLATFORMS
|
||||
from .services import async_setup_services
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=180)
|
||||
@@ -67,7 +67,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: EcobeeConfigEntry) -> bo
|
||||
await runtime_data.update()
|
||||
|
||||
if runtime_data.ecobee.thermostats is None:
|
||||
_LOGGER.error("No ecobee devices found to set up")
|
||||
LOGGER.error("No ecobee devices found to set up")
|
||||
return False
|
||||
|
||||
entry.runtime_data = runtime_data
|
||||
@@ -116,14 +116,14 @@ class EcobeeData:
|
||||
"""Get the latest data from ecobee.com."""
|
||||
try:
|
||||
await self._hass.async_add_executor_job(self.ecobee.update)
|
||||
_LOGGER.debug("Updating ecobee")
|
||||
LOGGER.debug("Updating ecobee")
|
||||
except ExpiredTokenError:
|
||||
_LOGGER.debug("Refreshing expired ecobee tokens")
|
||||
LOGGER.debug("Refreshing expired ecobee tokens")
|
||||
await self.refresh()
|
||||
|
||||
async def refresh(self) -> bool:
|
||||
"""Refresh ecobee tokens and update config entry."""
|
||||
_LOGGER.debug("Refreshing ecobee tokens and updating config entry")
|
||||
LOGGER.debug("Refreshing ecobee tokens and updating config entry")
|
||||
try:
|
||||
success = await self._hass.async_add_executor_job(
|
||||
self.ecobee.refresh_tokens
|
||||
@@ -144,7 +144,7 @@ class EcobeeData:
|
||||
translation_key="credentials_rejected",
|
||||
) from err
|
||||
except EcobeeAuthUnknownError:
|
||||
_LOGGER.exception("Unexpected error refreshing ecobee tokens")
|
||||
LOGGER.exception("Unexpected error refreshing ecobee tokens")
|
||||
return False
|
||||
|
||||
if success:
|
||||
@@ -167,7 +167,7 @@ class EcobeeData:
|
||||
data=data,
|
||||
)
|
||||
return True
|
||||
_LOGGER.error("Error refreshing ecobee tokens")
|
||||
LOGGER.error("Error refreshing ecobee tokens")
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@@ -40,12 +40,12 @@ from homeassistant.util.unit_conversion import TemperatureConverter
|
||||
|
||||
from . import EcobeeConfigEntry, EcobeeData
|
||||
from .const import (
|
||||
_LOGGER,
|
||||
ATTR_ACTIVE_SENSORS,
|
||||
ATTR_AVAILABLE_SENSORS,
|
||||
DOMAIN,
|
||||
ECOBEE_AUX_HEAT_ONLY,
|
||||
ECOBEE_MODEL_TO_NAME,
|
||||
LOGGER,
|
||||
MANUFACTURER,
|
||||
)
|
||||
from .services import (
|
||||
@@ -154,7 +154,7 @@ async def async_setup_entry(
|
||||
for index in range(len(data.ecobee.thermostats)):
|
||||
thermostat = data.ecobee.get_thermostat(index)
|
||||
if thermostat["modelNumber"] not in ECOBEE_MODEL_TO_NAME:
|
||||
_LOGGER.error(
|
||||
LOGGER.error(
|
||||
(
|
||||
"Model number for ecobee thermostat %s not recognized. "
|
||||
"Please visit this link to open a new issue: "
|
||||
@@ -565,7 +565,7 @@ class Thermostat(ClimateEntity):
|
||||
preset_mode = climate_ref
|
||||
break
|
||||
else:
|
||||
_LOGGER.warning("Received unknown preset mode: %s", preset_mode)
|
||||
LOGGER.warning("Received unknown preset mode: %s", preset_mode)
|
||||
|
||||
self.data.ecobee.set_climate_hold(
|
||||
self.thermostat_index,
|
||||
@@ -612,7 +612,7 @@ class Thermostat(ClimateEntity):
|
||||
self.hold_preference(),
|
||||
self.hold_hours(),
|
||||
)
|
||||
_LOGGER.debug(
|
||||
LOGGER.debug(
|
||||
"Setting ecobee hold_temp to: heat=%s, is=%s, cool=%s, is=%s",
|
||||
heat_temp,
|
||||
isinstance(heat_temp, (int, float)),
|
||||
@@ -634,7 +634,7 @@ class Thermostat(ClimateEntity):
|
||||
"""
|
||||
if fan_mode.lower() not in (FAN_ON, FAN_AUTO):
|
||||
error = "Invalid fan_mode value: Valid values are 'on' or 'auto'"
|
||||
_LOGGER.error(error)
|
||||
LOGGER.error(error)
|
||||
return
|
||||
|
||||
cool_temp = self.thermostat["runtime"]["desiredCool"] / 10.0
|
||||
@@ -649,7 +649,7 @@ class Thermostat(ClimateEntity):
|
||||
heatHoldTemp=heat_temp,
|
||||
)
|
||||
|
||||
_LOGGER.debug(
|
||||
LOGGER.debug(
|
||||
"Setting fan mode to: %s (preserving heat=%s cool=%s)",
|
||||
fan_mode,
|
||||
heat_temp,
|
||||
@@ -691,7 +691,7 @@ class Thermostat(ClimateEntity):
|
||||
elif temp is not None:
|
||||
self.set_temp_hold(temp)
|
||||
else:
|
||||
_LOGGER.error("Missing valid arguments for set_temperature in %s", kwargs)
|
||||
LOGGER.error("Missing valid arguments for set_temperature in %s", kwargs)
|
||||
|
||||
@override
|
||||
def set_humidity(self, humidity: int) -> None:
|
||||
@@ -709,7 +709,7 @@ class Thermostat(ClimateEntity):
|
||||
"""Set HVAC mode (auto, auxHeatOnly, cool, heat, off)."""
|
||||
ecobee_value = HASS_TO_ECOBEE_HVAC.get(hvac_mode)
|
||||
if ecobee_value is None:
|
||||
_LOGGER.error("Invalid mode for set_hvac_mode: %s", hvac_mode)
|
||||
LOGGER.error("Invalid mode for set_hvac_mode: %s", hvac_mode)
|
||||
return
|
||||
self.data.ecobee.set_hvac_mode(self.thermostat_index, ecobee_value)
|
||||
self.update_without_throttle = True
|
||||
@@ -795,7 +795,7 @@ class Thermostat(ClimateEntity):
|
||||
# Check if sensors are currently used on the climate for the thermostat.
|
||||
current_sensors_in_climate = self._sensors_in_preset_mode(preset_mode)
|
||||
if set(sensor_names) == set(current_sensors_in_climate):
|
||||
_LOGGER.debug(
|
||||
LOGGER.debug(
|
||||
"This action would not be an update, current sensors"
|
||||
" on climate (%s) are: %s",
|
||||
preset_mode,
|
||||
@@ -803,7 +803,7 @@ class Thermostat(ClimateEntity):
|
||||
)
|
||||
return
|
||||
|
||||
_LOGGER.debug(
|
||||
LOGGER.debug(
|
||||
"Setting sensors %s to be used on thermostat %s for program %s",
|
||||
sensor_names,
|
||||
self.device_info.get("name"),
|
||||
@@ -899,7 +899,7 @@ class Thermostat(ClimateEntity):
|
||||
if value is not None
|
||||
}
|
||||
|
||||
_LOGGER.debug(
|
||||
LOGGER.debug(
|
||||
(
|
||||
"Creating a vacation on thermostat %s with name %s, cool temp %s, heat"
|
||||
" temp %s, and the following other parameters: %s"
|
||||
@@ -916,7 +916,7 @@ class Thermostat(ClimateEntity):
|
||||
|
||||
def delete_vacation(self, vacation_name):
|
||||
"""Delete a vacation with the specified name."""
|
||||
_LOGGER.debug(
|
||||
LOGGER.debug(
|
||||
"Deleting a vacation on thermostat %s with name %s",
|
||||
self.name,
|
||||
vacation_name,
|
||||
@@ -926,7 +926,7 @@ class Thermostat(ClimateEntity):
|
||||
@override
|
||||
def turn_on(self) -> None:
|
||||
"""Set the thermostat to the last active HVAC mode."""
|
||||
_LOGGER.debug(
|
||||
LOGGER.debug(
|
||||
"Turning on ecobee thermostat %s in %s mode",
|
||||
self.name,
|
||||
self._last_active_hvac_mode,
|
||||
|
||||
@@ -17,7 +17,7 @@ from homeassistant.components.weather import (
|
||||
)
|
||||
from homeassistant.const import Platform
|
||||
|
||||
_LOGGER = logging.getLogger(__package__)
|
||||
LOGGER = logging.getLogger(__package__)
|
||||
|
||||
DOMAIN = "ecobee"
|
||||
ATTR_AVAILABLE_SENSORS = "available_sensors"
|
||||
|
||||
Reference in New Issue
Block a user