1
mirror of https://github.com/home-assistant/core synced 2024-10-07 10:13:38 +02:00

Clean up Tuya loggers (#62999)

This commit is contained in:
Franck Nijhof 2021-12-29 15:12:27 +01:00 committed by GitHub
parent bd98fc231d
commit 32d1e28dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 17 deletions

View File

@ -1,7 +1,6 @@
"""Support for Tuya Smart devices."""
from __future__ import annotations
import logging
from typing import NamedTuple
import requests
@ -34,14 +33,13 @@ from .const import (
CONF_PROJECT_TYPE,
CONF_USERNAME,
DOMAIN,
LOGGER,
PLATFORMS,
TUYA_DISCOVERY_NEW,
TUYA_HA_SIGNAL_UPDATE_ENTITY,
DPCode,
)
_LOGGER = logging.getLogger(__name__)
class HomeAssistantTuyaData(NamedTuple):
"""Tuya data stored in the Home Assistant data object."""
@ -250,7 +248,7 @@ class DeviceListener(TuyaDeviceListener):
def update_device(self, device: TuyaDevice) -> None:
"""Update device status."""
if device.id in self.device_ids:
_LOGGER.debug(
LOGGER.debug(
"Received update for device %s: %s",
device.id,
self.device_manager.device_map[device.id].status,
@ -280,7 +278,7 @@ class DeviceListener(TuyaDeviceListener):
@callback
def async_remove_device(self, device_id: str) -> None:
"""Remove device from Home Assistant."""
_LOGGER.debug("Remove device: %s", device_id)
LOGGER.debug("Remove device: %s", device_id)
device_registry = dr.async_get(self.hass)
device_entry = device_registry.async_get_device(
identifiers={(DOMAIN, device_id)}

View File

@ -3,7 +3,6 @@ from __future__ import annotations
from dataclasses import dataclass
import json
import logging
from typing import Any
from tuya_iot import TuyaDevice, TuyaDeviceManager
@ -11,11 +10,9 @@ from tuya_iot import TuyaDevice, TuyaDeviceManager
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo, Entity
from .const import DOMAIN, TUYA_HA_SIGNAL_UPDATE_ENTITY
from .const import DOMAIN, LOGGER, TUYA_HA_SIGNAL_UPDATE_ENTITY
from .util import remap_value
_LOGGER = logging.getLogger(__name__)
@dataclass
class IntegerTypeData:
@ -151,5 +148,5 @@ class TuyaEntity(Entity):
def _send_command(self, commands: list[dict[str, Any]]) -> None:
"""Send command to the device."""
_LOGGER.debug("Sending commands for device %s: %s", self.device.id, commands)
LOGGER.debug("Sending commands for device %s: %s", self.device.id, commands)
self.device_manager.send_commands(self.device.id, commands)

View File

@ -1,7 +1,6 @@
"""Config flow for Tuya."""
from __future__ import annotations
import logging
from typing import Any
from tuya_iot import AuthType, TuyaOpenAPI
@ -19,6 +18,7 @@ from .const import (
CONF_PASSWORD,
CONF_USERNAME,
DOMAIN,
LOGGER,
SMARTLIFE_APP,
TUYA_COUNTRIES,
TUYA_RESPONSE_CODE,
@ -29,8 +29,6 @@ from .const import (
TUYA_SMART_APP,
)
_LOGGER = logging.getLogger(__name__)
class TuyaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Tuya Config Flow."""
@ -78,7 +76,7 @@ class TuyaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
schema=data[CONF_APP_TYPE],
)
_LOGGER.debug("Response %s", response)
LOGGER.debug("Response %s", response)
if response.get(TUYA_RESPONSE_SUCCESS, False):
break

View File

@ -2,7 +2,6 @@
from __future__ import annotations
from dataclasses import dataclass
import logging
from typing import Any
from tuya_iot import TuyaDevice, TuyaDeviceManager
@ -27,8 +26,6 @@ from . import HomeAssistantTuyaData
from .base import EnumTypeData, IntegerTypeData, TuyaEntity
from .const import DOMAIN, TUYA_DISCOVERY_NEW, DPCode
_LOGGER = logging.getLogger(__name__)
@dataclass
class TuyaCoverEntityDescription(CoverEntityDescription):