diff --git a/homeassistant/components/flo/config_flow.py b/homeassistant/components/flo/config_flow.py index b509c894068..54c6ae94ee2 100644 --- a/homeassistant/components/flo/config_flow.py +++ b/homeassistant/components/flo/config_flow.py @@ -1,6 +1,4 @@ """Config flow for flo integration.""" -import logging - from aioflo import async_get_api from aioflo.errors import RequestError import voluptuous as vol @@ -9,9 +7,7 @@ from homeassistant import config_entries, core, exceptions from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers.aiohttp_client import async_get_clientsession -from .const import DOMAIN # pylint:disable=unused-import - -_LOGGER = logging.getLogger(__name__) +from .const import DOMAIN, LOGGER # pylint:disable=unused-import DATA_SCHEMA = vol.Schema({"username": str, "password": str}) @@ -28,7 +24,7 @@ async def validate_input(hass: core.HomeAssistant, data): data[CONF_USERNAME], data[CONF_PASSWORD], session=session ) except RequestError as request_error: - _LOGGER.error("Error connecting to the Flo API: %s", request_error) + LOGGER.error("Error connecting to the Flo API: %s", request_error) raise CannotConnect from request_error user_info = await api.user.get_info() diff --git a/homeassistant/components/flo/const.py b/homeassistant/components/flo/const.py index 94c1b8d4579..907561b5b9c 100644 --- a/homeassistant/components/flo/const.py +++ b/homeassistant/components/flo/const.py @@ -1,4 +1,8 @@ """Constants for the flo integration.""" +import logging + +LOGGER = logging.getLogger(__package__) + CLIENT = "client" DOMAIN = "flo" FLO_HOME = "home" diff --git a/homeassistant/components/flo/device.py b/homeassistant/components/flo/device.py index 824d62a9519..af36034026d 100644 --- a/homeassistant/components/flo/device.py +++ b/homeassistant/components/flo/device.py @@ -1,7 +1,6 @@ """Flo device object.""" import asyncio from datetime import datetime, timedelta -import logging from typing import Any, Dict, Optional from aioflo.api import API @@ -12,9 +11,7 @@ from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed import homeassistant.util.dt as dt_util -from .const import DOMAIN as FLO_DOMAIN - -_LOGGER = logging.getLogger(__name__) +from .const import DOMAIN as FLO_DOMAIN, LOGGER class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator): @@ -33,7 +30,7 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator): self._water_usage: Optional[Dict[str, Any]] = None super().__init__( hass, - _LOGGER, + LOGGER, name=f"{FLO_DOMAIN}-{device_id}", update_interval=timedelta(seconds=60), ) @@ -195,7 +192,7 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator): self._device_information = await self.api_client.device.get_info( self._flo_device_id ) - _LOGGER.debug("Flo device data: %s", self._device_information) + LOGGER.debug("Flo device data: %s", self._device_information) async def _update_consumption_data(self, *_) -> None: """Update water consumption data from the API.""" @@ -205,4 +202,4 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator): self._water_usage = await self.api_client.water.get_consumption_info( self._flo_location_id, start_date, end_date ) - _LOGGER.debug("Updated Flo consumption data: %s", self._water_usage) + LOGGER.debug("Updated Flo consumption data: %s", self._water_usage)