mirror of
https://github.com/home-assistant/core.git
synced 2025-09-11 15:51:47 +02:00
modbus: use only 1 logger instance. (#150130)
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||
@@ -24,6 +23,7 @@ from homeassistant.helpers.update_coordinator import (
|
||||
|
||||
from . import get_hub
|
||||
from .const import (
|
||||
_LOGGER,
|
||||
CALL_TYPE_COIL,
|
||||
CALL_TYPE_DISCRETE,
|
||||
CONF_SLAVE_COUNT,
|
||||
@@ -32,8 +32,6 @@ from .const import (
|
||||
from .entity import BasePlatform
|
||||
from .modbus import ModbusHub
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import struct
|
||||
from typing import Any, cast
|
||||
|
||||
@@ -44,6 +43,7 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import get_hub
|
||||
from .const import (
|
||||
_LOGGER,
|
||||
CALL_TYPE_COIL,
|
||||
CALL_TYPE_REGISTER_HOLDING,
|
||||
CALL_TYPE_WRITE_COIL,
|
||||
@@ -104,8 +104,6 @@ from .const import (
|
||||
from .entity import BaseStructPlatform
|
||||
from .modbus import ModbusHub
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
HVACMODE_TO_TARG_TEMP_REG_INDEX_ARRAY = {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
"""Constants used in modbus integration."""
|
||||
|
||||
from enum import Enum
|
||||
import logging
|
||||
|
||||
from homeassistant.const import (
|
||||
CONF_ADDRESS,
|
||||
@@ -177,3 +178,5 @@ LIGHT_MAX_BRIGHTNESS = 255
|
||||
LIGHT_MODBUS_SCALE_MIN = 0
|
||||
LIGHT_MODBUS_SCALE_MAX = 100
|
||||
LIGHT_MODBUS_INVALID_VALUE = 0xFFFF
|
||||
|
||||
_LOGGER = logging.getLogger(__package__)
|
||||
|
@@ -6,7 +6,6 @@ from abc import abstractmethod
|
||||
import asyncio
|
||||
from collections.abc import Callable
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
import struct
|
||||
from typing import Any, cast
|
||||
|
||||
@@ -33,6 +32,7 @@ from homeassistant.helpers.event import async_call_later, async_track_time_inter
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
|
||||
from .const import (
|
||||
_LOGGER,
|
||||
CALL_TYPE_COIL,
|
||||
CALL_TYPE_DISCRETE,
|
||||
CALL_TYPE_REGISTER_HOLDING,
|
||||
@@ -68,8 +68,6 @@ from .const import (
|
||||
)
|
||||
from .modbus import ModbusHub
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BasePlatform(Entity):
|
||||
"""Base for readonly platforms."""
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.light import (
|
||||
@@ -35,7 +34,6 @@ from .entity import BaseSwitch
|
||||
from .modbus import ModbusHub
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
|
@@ -5,7 +5,6 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
from collections import namedtuple
|
||||
from collections.abc import Callable
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from pymodbus.client import (
|
||||
@@ -38,6 +37,7 @@ from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util.hass_dict import HassKey
|
||||
|
||||
from .const import (
|
||||
_LOGGER,
|
||||
ATTR_ADDRESS,
|
||||
ATTR_HUB,
|
||||
ATTR_SLAVE,
|
||||
@@ -70,7 +70,6 @@ from .const import (
|
||||
)
|
||||
from .validators import check_config
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
DATA_MODBUS_HUBS: HassKey[dict[str, ModbusHub]] = HassKey(DOMAIN)
|
||||
|
||||
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
@@ -26,12 +25,10 @@ from homeassistant.helpers.update_coordinator import (
|
||||
)
|
||||
|
||||
from . import get_hub
|
||||
from .const import CONF_SLAVE_COUNT, CONF_VIRTUAL_COUNT
|
||||
from .const import _LOGGER, CONF_SLAVE_COUNT, CONF_VIRTUAL_COUNT
|
||||
from .entity import BaseStructPlatform
|
||||
from .modbus import ModbusHub
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user