mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Move Flo logger to a package logger (#43449)
This commit is contained in:
parent
dd4f41c1db
commit
a880ef6a4e
@ -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()
|
||||
|
@ -1,4 +1,8 @@
|
||||
"""Constants for the flo integration."""
|
||||
import logging
|
||||
|
||||
LOGGER = logging.getLogger(__package__)
|
||||
|
||||
CLIENT = "client"
|
||||
DOMAIN = "flo"
|
||||
FLO_HOME = "home"
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user