From 1f76482504d30aebd31eba5d3acfe4bb2e23b8a4 Mon Sep 17 00:00:00 2001 From: Wentao Wu Date: Tue, 21 May 2024 12:22:58 +0800 Subject: [PATCH] enable python3 isort and fix with error --- custom_components/midea_ac_lan/__init__.py | 27 ++++++++--- custom_components/midea_ac_lan/climate.py | 45 +++++++++++++------ custom_components/midea_ac_lan/config_flow.py | 32 ++++++++++--- custom_components/midea_ac_lan/fan.py | 9 +++- custom_components/midea_ac_lan/humidifier.py | 8 ++-- custom_components/midea_ac_lan/light.py | 16 ++++--- .../midea_ac_lan/midea/core/cloud.py | 8 +++- .../midea_ac_lan/midea/core/device.py | 15 +++++-- .../midea_ac_lan/midea/devices/a1/message.py | 9 +++- .../midea_ac_lan/midea/devices/ac/device.py | 15 +++++-- .../midea_ac_lan/midea/devices/ac/message.py | 9 +++- .../midea_ac_lan/midea/devices/b0/message.py | 3 +- .../midea_ac_lan/midea/devices/b1/message.py | 3 +- .../midea_ac_lan/midea/devices/b3/message.py | 3 +- .../midea_ac_lan/midea/devices/b4/message.py | 3 +- .../midea_ac_lan/midea/devices/b6/message.py | 3 +- .../midea_ac_lan/midea/devices/bf/message.py | 3 +- .../midea_ac_lan/midea/devices/c2/message.py | 3 +- .../midea_ac_lan/midea/devices/c3/device.py | 9 +++- .../midea_ac_lan/midea/devices/c3/message.py | 3 +- .../midea_ac_lan/midea/devices/ca/message.py | 3 +- .../midea_ac_lan/midea/devices/cc/message.py | 3 +- .../midea_ac_lan/midea/devices/cd/message.py | 3 +- .../midea_ac_lan/midea/devices/ce/message.py | 3 +- .../midea_ac_lan/midea/devices/cf/message.py | 3 +- .../midea_ac_lan/midea/devices/da/device.py | 3 +- .../midea_ac_lan/midea/devices/da/message.py | 3 +- .../midea_ac_lan/midea/devices/db/device.py | 3 +- .../midea_ac_lan/midea/devices/db/message.py | 3 +- .../midea_ac_lan/midea/devices/dc/device.py | 3 +- .../midea_ac_lan/midea/devices/dc/message.py | 3 +- .../midea_ac_lan/midea/devices/e1/device.py | 9 +++- .../midea_ac_lan/midea/devices/e1/message.py | 3 +- .../midea_ac_lan/midea/devices/e2/device.py | 9 +++- .../midea_ac_lan/midea/devices/e2/message.py | 3 +- .../midea_ac_lan/midea/devices/e3/device.py | 9 +++- .../midea_ac_lan/midea/devices/e3/message.py | 3 +- .../midea_ac_lan/midea/devices/e6/message.py | 3 +- .../midea_ac_lan/midea/devices/e8/message.py | 3 +- .../midea_ac_lan/midea/devices/ea/message.py | 3 +- .../midea_ac_lan/midea/devices/ec/message.py | 3 +- .../midea_ac_lan/midea/devices/ed/device.py | 3 +- .../midea_ac_lan/midea/devices/ed/message.py | 3 +- .../midea_ac_lan/midea/devices/fa/message.py | 3 +- .../midea_ac_lan/midea/devices/fb/message.py | 3 +- .../midea_ac_lan/midea/devices/fc/message.py | 3 +- .../midea_ac_lan/midea/devices/fd/message.py | 3 +- .../midea_ac_lan/midea/devices/x13/message.py | 3 +- .../midea_ac_lan/midea/devices/x26/message.py | 3 +- .../midea_ac_lan/midea/devices/x34/device.py | 9 +++- .../midea_ac_lan/midea/devices/x34/message.py | 3 +- .../midea_ac_lan/midea/devices/x40/message.py | 3 +- .../midea_ac_lan/midea_devices.py | 15 +++++-- .../midea_ac_lan/water_heater.py | 21 ++++++--- 54 files changed, 240 insertions(+), 142 deletions(-) diff --git a/custom_components/midea_ac_lan/__init__.py b/custom_components/midea_ac_lan/__init__.py index 744108ba..014d7650 100644 --- a/custom_components/midea_ac_lan/__init__.py +++ b/custom_components/midea_ac_lan/__init__.py @@ -2,14 +2,29 @@ import homeassistant.helpers.config_validation as cv import voluptuous as vol -from homeassistant.const import (CONF_CUSTOMIZE, CONF_DEVICE_ID, - CONF_IP_ADDRESS, CONF_NAME, CONF_PORT, - CONF_PROTOCOL, CONF_TOKEN, CONF_TYPE) +from homeassistant.const import ( + CONF_CUSTOMIZE, + CONF_DEVICE_ID, + CONF_IP_ADDRESS, + CONF_NAME, + CONF_PORT, + CONF_PROTOCOL, + CONF_TOKEN, + CONF_TYPE, +) from homeassistant.core import HomeAssistant -from .const import (ALL_PLATFORM, CONF_ACCOUNT, CONF_KEY, CONF_MODEL, - CONF_REFRESH_INTERVAL, CONF_SUBTYPE, DEVICES, DOMAIN, - EXTRA_SWITCH) +from .const import ( + ALL_PLATFORM, + CONF_ACCOUNT, + CONF_KEY, + CONF_MODEL, + CONF_REFRESH_INTERVAL, + CONF_SUBTYPE, + DEVICES, + DOMAIN, + EXTRA_SWITCH, +) from .midea.devices import async_device_selector from .midea_devices import MIDEA_DEVICES diff --git a/custom_components/midea_ac_lan/climate.py b/custom_components/midea_ac_lan/climate.py index 4341edc4..1e0df6bc 100644 --- a/custom_components/midea_ac_lan/climate.py +++ b/custom_components/midea_ac_lan/climate.py @@ -1,18 +1,37 @@ import logging -from homeassistant.components.climate import (ATTR_HVAC_MODE, FAN_AUTO, - FAN_HIGH, FAN_LOW, FAN_MEDIUM, - PRESET_AWAY, PRESET_BOOST, - PRESET_COMFORT, PRESET_ECO, - PRESET_NONE, PRESET_SLEEP, - SWING_BOTH, SWING_HORIZONTAL, - SWING_OFF, SWING_ON, - SWING_VERTICAL, ClimateEntity, - ClimateEntityFeature, HVACMode) -from homeassistant.const import (ATTR_TEMPERATURE, CONF_DEVICE_ID, - CONF_SWITCHES, MAJOR_VERSION, MINOR_VERSION, - PRECISION_HALVES, PRECISION_WHOLE, Platform, - UnitOfTemperature) +from homeassistant.components.climate import ( + ATTR_HVAC_MODE, + FAN_AUTO, + FAN_HIGH, + FAN_LOW, + FAN_MEDIUM, + PRESET_AWAY, + PRESET_BOOST, + PRESET_COMFORT, + PRESET_ECO, + PRESET_NONE, + PRESET_SLEEP, + SWING_BOTH, + SWING_HORIZONTAL, + SWING_OFF, + SWING_ON, + SWING_VERTICAL, + ClimateEntity, + ClimateEntityFeature, + HVACMode, +) +from homeassistant.const import ( + ATTR_TEMPERATURE, + CONF_DEVICE_ID, + CONF_SWITCHES, + MAJOR_VERSION, + MINOR_VERSION, + PRECISION_HALVES, + PRECISION_WHOLE, + Platform, + UnitOfTemperature, +) from .const import DEVICES, DOMAIN from .midea.devices.ac.device import DeviceAttributes as ACAttributes diff --git a/custom_components/midea_ac_lan/config_flow.py b/custom_components/midea_ac_lan/config_flow.py index 402a11e3..6c5b1ecc 100644 --- a/custom_components/midea_ac_lan/config_flow.py +++ b/custom_components/midea_ac_lan/config_flow.py @@ -11,17 +11,35 @@ import homeassistant.helpers.config_validation as cv from homeassistant import config_entries -from homeassistant.const import (CONF_CUSTOMIZE, CONF_DEVICE, CONF_DEVICE_ID, - CONF_IP_ADDRESS, CONF_NAME, CONF_PASSWORD, - CONF_PORT, CONF_PROTOCOL, CONF_SENSORS, - CONF_SWITCHES, CONF_TOKEN, CONF_TYPE) +from homeassistant.const import ( + CONF_CUSTOMIZE, + CONF_DEVICE, + CONF_DEVICE_ID, + CONF_IP_ADDRESS, + CONF_NAME, + CONF_PASSWORD, + CONF_PORT, + CONF_PROTOCOL, + CONF_SENSORS, + CONF_SWITCHES, + CONF_TOKEN, + CONF_TYPE, +) from homeassistant.core import callback from homeassistant.helpers.aiohttp_client import async_create_clientsession from homeassistant.util.json import load_json -from .const import (CONF_ACCOUNT, CONF_KEY, CONF_MODEL, CONF_REFRESH_INTERVAL, - CONF_SERVER, CONF_SUBTYPE, DOMAIN, EXTRA_CONTROL, - EXTRA_SENSOR) +from .const import ( + CONF_ACCOUNT, + CONF_KEY, + CONF_MODEL, + CONF_REFRESH_INTERVAL, + CONF_SERVER, + CONF_SUBTYPE, + DOMAIN, + EXTRA_CONTROL, + EXTRA_SENSOR, +) from .midea.core.cloud import get_midea_cloud from .midea.core.device import MiedaDevice from .midea.core.discover import discover diff --git a/custom_components/midea_ac_lan/fan.py b/custom_components/midea_ac_lan/fan.py index e5a939e1..7ddd8614 100644 --- a/custom_components/midea_ac_lan/fan.py +++ b/custom_components/midea_ac_lan/fan.py @@ -2,8 +2,13 @@ from typing import Any from homeassistant.components.fan import FanEntity, FanEntityFeature -from homeassistant.const import (CONF_DEVICE_ID, CONF_SWITCHES, STATE_OFF, - STATE_ON, Platform) +from homeassistant.const import ( + CONF_DEVICE_ID, + CONF_SWITCHES, + STATE_OFF, + STATE_ON, + Platform, +) from .const import DEVICES, DOMAIN from .midea.devices.ac.device import DeviceAttributes as ACAttributes diff --git a/custom_components/midea_ac_lan/humidifier.py b/custom_components/midea_ac_lan/humidifier.py index 530a11ed..1027b585 100644 --- a/custom_components/midea_ac_lan/humidifier.py +++ b/custom_components/midea_ac_lan/humidifier.py @@ -1,8 +1,10 @@ import logging -from homeassistant.components.humidifier import (HumidifierDeviceClass, - HumidifierEntity, - HumidifierEntityFeature) +from homeassistant.components.humidifier import ( + HumidifierDeviceClass, + HumidifierEntity, + HumidifierEntityFeature, +) from homeassistant.const import CONF_DEVICE_ID, CONF_SWITCHES, Platform from .const import DEVICES, DOMAIN diff --git a/custom_components/midea_ac_lan/light.py b/custom_components/midea_ac_lan/light.py index 558f1733..91747b87 100644 --- a/custom_components/midea_ac_lan/light.py +++ b/custom_components/midea_ac_lan/light.py @@ -1,11 +1,17 @@ import logging from typing import Any -from homeassistant.components.light import (ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, - ATTR_EFFECT, SUPPORT_BRIGHTNESS, - SUPPORT_COLOR, SUPPORT_COLOR_TEMP, - SUPPORT_EFFECT, LightEntity, - LightEntityFeature) +from homeassistant.components.light import ( + ATTR_BRIGHTNESS, + ATTR_COLOR_TEMP, + ATTR_EFFECT, + SUPPORT_BRIGHTNESS, + SUPPORT_COLOR, + SUPPORT_COLOR_TEMP, + SUPPORT_EFFECT, + LightEntity, + LightEntityFeature, +) from homeassistant.const import CONF_DEVICE_ID, CONF_SWITCHES, Platform from .const import DEVICES, DOMAIN diff --git a/custom_components/midea_ac_lan/midea/core/cloud.py b/custom_components/midea_ac_lan/midea/core/cloud.py index 127d7212..f4eb2eb0 100644 --- a/custom_components/midea_ac_lan/midea/core/cloud.py +++ b/custom_components/midea_ac_lan/midea/core/cloud.py @@ -8,8 +8,12 @@ from aiohttp import ClientSession -from .security import (CloudSecurity, MeijuCloudSecurity, MideaAirSecurity, - MSmartCloudSecurity) +from .security import ( + CloudSecurity, + MeijuCloudSecurity, + MideaAirSecurity, + MSmartCloudSecurity, +) _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/midea_ac_lan/midea/core/device.py b/custom_components/midea_ac_lan/midea/core/device.py index f5aab05c..f47c2955 100644 --- a/custom_components/midea_ac_lan/midea/core/device.py +++ b/custom_components/midea_ac_lan/midea/core/device.py @@ -10,11 +10,18 @@ import time from enum import IntEnum -from .message import (MessageApplianceResponse, MessageQueryAppliance, - MessageQuestCustom, MessageType) +from .message import ( + MessageApplianceResponse, + MessageQueryAppliance, + MessageQuestCustom, + MessageType, +) from .packet_builder import PacketBuilder -from .security import (MSGTYPE_ENCRYPTED_REQUEST, MSGTYPE_HANDSHAKE_REQUEST, - LocalSecurity) +from .security import ( + MSGTYPE_ENCRYPTED_REQUEST, + MSGTYPE_HANDSHAKE_REQUEST, + LocalSecurity, +) _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/midea_ac_lan/midea/devices/a1/message.py b/custom_components/midea_ac_lan/midea/devices/a1/message.py index 9f7bfc5f..f6a43b7a 100644 --- a/custom_components/midea_ac_lan/midea/devices/a1/message.py +++ b/custom_components/midea_ac_lan/midea/devices/a1/message.py @@ -1,8 +1,13 @@ from enum import IntEnum from ...core.crc8 import calculate -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType, NewProtocolMessageBody) +from ...core.message import ( + MessageBody, + MessageRequest, + MessageResponse, + MessageType, + NewProtocolMessageBody, +) class NewProtocolTags(IntEnum): diff --git a/custom_components/midea_ac_lan/midea/devices/ac/device.py b/custom_components/midea_ac_lan/midea/devices/ac/device.py index 6d91ce12..87ccb1c2 100644 --- a/custom_components/midea_ac_lan/midea/devices/ac/device.py +++ b/custom_components/midea_ac_lan/midea/devices/ac/device.py @@ -1,10 +1,17 @@ import json import logging -from .message import (MessageACResponse, MessageGeneralSet, - MessageNewProtocolQuery, MessageNewProtocolSet, - MessagePowerQuery, MessageQuery, MessageSubProtocolQuery, - MessageSubProtocolSet, MessageToggleDisplay) +from .message import ( + MessageACResponse, + MessageGeneralSet, + MessageNewProtocolQuery, + MessageNewProtocolSet, + MessagePowerQuery, + MessageQuery, + MessageSubProtocolQuery, + MessageSubProtocolSet, + MessageToggleDisplay, +) try: from enum import StrEnum diff --git a/custom_components/midea_ac_lan/midea/devices/ac/message.py b/custom_components/midea_ac_lan/midea/devices/ac/message.py index 642e2032..9c5816b3 100644 --- a/custom_components/midea_ac_lan/midea/devices/ac/message.py +++ b/custom_components/midea_ac_lan/midea/devices/ac/message.py @@ -1,8 +1,13 @@ from enum import IntEnum from ...core.crc8 import calculate -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType, NewProtocolMessageBody) +from ...core.message import ( + MessageBody, + MessageRequest, + MessageResponse, + MessageType, + NewProtocolMessageBody, +) BB_AC_MODES = [0, 3, 1, 2, 4, 5] diff --git a/custom_components/midea_ac_lan/midea/devices/b0/message.py b/custom_components/midea_ac_lan/midea/devices/b0/message.py index b03bce32..ebed3bdd 100644 --- a/custom_components/midea_ac_lan/midea/devices/b0/message.py +++ b/custom_components/midea_ac_lan/midea/devices/b0/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageB0Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/b1/message.py b/custom_components/midea_ac_lan/midea/devices/b1/message.py index c18c3c81..d7d6fb63 100644 --- a/custom_components/midea_ac_lan/midea/devices/b1/message.py +++ b/custom_components/midea_ac_lan/midea/devices/b1/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageB1Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/b3/message.py b/custom_components/midea_ac_lan/midea/devices/b3/message.py index 5d4a61c8..c06e22a8 100644 --- a/custom_components/midea_ac_lan/midea/devices/b3/message.py +++ b/custom_components/midea_ac_lan/midea/devices/b3/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageB3Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/b4/message.py b/custom_components/midea_ac_lan/midea/devices/b4/message.py index 8e2f1ca1..07cc1ee9 100644 --- a/custom_components/midea_ac_lan/midea/devices/b4/message.py +++ b/custom_components/midea_ac_lan/midea/devices/b4/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageB4Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/b6/message.py b/custom_components/midea_ac_lan/midea/devices/b6/message.py index 0080aefb..53a1b78e 100644 --- a/custom_components/midea_ac_lan/midea/devices/b6/message.py +++ b/custom_components/midea_ac_lan/midea/devices/b6/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageB6Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/bf/message.py b/custom_components/midea_ac_lan/midea/devices/bf/message.py index 2ddf64dc..358ce3eb 100644 --- a/custom_components/midea_ac_lan/midea/devices/bf/message.py +++ b/custom_components/midea_ac_lan/midea/devices/bf/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageBFBase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/c2/message.py b/custom_components/midea_ac_lan/midea/devices/c2/message.py index d95e3588..4ab2c023 100644 --- a/custom_components/midea_ac_lan/midea/devices/c2/message.py +++ b/custom_components/midea_ac_lan/midea/devices/c2/message.py @@ -1,7 +1,6 @@ from enum import IntEnum -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class C2MessageEnum(IntEnum): diff --git a/custom_components/midea_ac_lan/midea/devices/c3/device.py b/custom_components/midea_ac_lan/midea/devices/c3/device.py index 7c9e0f10..c513ec4c 100644 --- a/custom_components/midea_ac_lan/midea/devices/c3/device.py +++ b/custom_components/midea_ac_lan/midea/devices/c3/device.py @@ -1,7 +1,12 @@ import logging -from .message import (MessageC3Response, MessageQuery, MessageSet, - MessageSetECO, MessageSetSilent) +from .message import ( + MessageC3Response, + MessageQuery, + MessageSet, + MessageSetECO, + MessageSetSilent, +) try: from enum import StrEnum diff --git a/custom_components/midea_ac_lan/midea/devices/c3/message.py b/custom_components/midea_ac_lan/midea/devices/c3/message.py index 8a4bd37c..cd2d4243 100644 --- a/custom_components/midea_ac_lan/midea/devices/c3/message.py +++ b/custom_components/midea_ac_lan/midea/devices/c3/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageC3Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/ca/message.py b/custom_components/midea_ac_lan/midea/devices/ca/message.py index bdd14eaa..0611a875 100644 --- a/custom_components/midea_ac_lan/midea/devices/ca/message.py +++ b/custom_components/midea_ac_lan/midea/devices/ca/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageCABase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/cc/message.py b/custom_components/midea_ac_lan/midea/devices/cc/message.py index 40187256..f94a7c34 100644 --- a/custom_components/midea_ac_lan/midea/devices/cc/message.py +++ b/custom_components/midea_ac_lan/midea/devices/cc/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageCCBase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/cd/message.py b/custom_components/midea_ac_lan/midea/devices/cd/message.py index 32ff6210..454cfe00 100644 --- a/custom_components/midea_ac_lan/midea/devices/cd/message.py +++ b/custom_components/midea_ac_lan/midea/devices/cd/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageCDBase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/ce/message.py b/custom_components/midea_ac_lan/midea/devices/ce/message.py index 2afa41b6..0f6afe3f 100644 --- a/custom_components/midea_ac_lan/midea/devices/ce/message.py +++ b/custom_components/midea_ac_lan/midea/devices/ce/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageFABase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/cf/message.py b/custom_components/midea_ac_lan/midea/devices/cf/message.py index 1afe96e1..0bf0fb3f 100644 --- a/custom_components/midea_ac_lan/midea/devices/cf/message.py +++ b/custom_components/midea_ac_lan/midea/devices/cf/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageCFBase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/da/device.py b/custom_components/midea_ac_lan/midea/devices/da/device.py index e39be85a..f5506e40 100644 --- a/custom_components/midea_ac_lan/midea/devices/da/device.py +++ b/custom_components/midea_ac_lan/midea/devices/da/device.py @@ -1,7 +1,6 @@ import logging -from .message import (MessageDAResponse, MessagePower, MessageQuery, - MessageStart) +from .message import MessageDAResponse, MessagePower, MessageQuery, MessageStart try: from enum import StrEnum diff --git a/custom_components/midea_ac_lan/midea/devices/da/message.py b/custom_components/midea_ac_lan/midea/devices/da/message.py index f16faa26..5578d46b 100644 --- a/custom_components/midea_ac_lan/midea/devices/da/message.py +++ b/custom_components/midea_ac_lan/midea/devices/da/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageDABase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/db/device.py b/custom_components/midea_ac_lan/midea/devices/db/device.py index e39d3af3..fe1c02e4 100644 --- a/custom_components/midea_ac_lan/midea/devices/db/device.py +++ b/custom_components/midea_ac_lan/midea/devices/db/device.py @@ -1,7 +1,6 @@ import logging -from .message import (MessageDBResponse, MessagePower, MessageQuery, - MessageStart) +from .message import MessageDBResponse, MessagePower, MessageQuery, MessageStart try: from enum import StrEnum diff --git a/custom_components/midea_ac_lan/midea/devices/db/message.py b/custom_components/midea_ac_lan/midea/devices/db/message.py index 88c176ee..7a70ca55 100644 --- a/custom_components/midea_ac_lan/midea/devices/db/message.py +++ b/custom_components/midea_ac_lan/midea/devices/db/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageDBBase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/dc/device.py b/custom_components/midea_ac_lan/midea/devices/dc/device.py index 6c83d366..7e6d659f 100644 --- a/custom_components/midea_ac_lan/midea/devices/dc/device.py +++ b/custom_components/midea_ac_lan/midea/devices/dc/device.py @@ -1,7 +1,6 @@ import logging -from .message import (MessageDCResponse, MessagePower, MessageQuery, - MessageStart) +from .message import MessageDCResponse, MessagePower, MessageQuery, MessageStart try: from enum import StrEnum diff --git a/custom_components/midea_ac_lan/midea/devices/dc/message.py b/custom_components/midea_ac_lan/midea/devices/dc/message.py index 3615159d..3be5d3dd 100644 --- a/custom_components/midea_ac_lan/midea/devices/dc/message.py +++ b/custom_components/midea_ac_lan/midea/devices/dc/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageDCBase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/e1/device.py b/custom_components/midea_ac_lan/midea/devices/e1/device.py index 61285f5e..43c72ffa 100644 --- a/custom_components/midea_ac_lan/midea/devices/e1/device.py +++ b/custom_components/midea_ac_lan/midea/devices/e1/device.py @@ -1,7 +1,12 @@ import logging -from .message import (MessageE1Response, MessageLock, MessagePower, - MessageQuery, MessageStorage) +from .message import ( + MessageE1Response, + MessageLock, + MessagePower, + MessageQuery, + MessageStorage, +) try: from enum import StrEnum diff --git a/custom_components/midea_ac_lan/midea/devices/e1/message.py b/custom_components/midea_ac_lan/midea/devices/e1/message.py index 28045b6d..530572e8 100644 --- a/custom_components/midea_ac_lan/midea/devices/e1/message.py +++ b/custom_components/midea_ac_lan/midea/devices/e1/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageE1Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/e2/device.py b/custom_components/midea_ac_lan/midea/devices/e2/device.py index b429899b..b261a44f 100644 --- a/custom_components/midea_ac_lan/midea/devices/e2/device.py +++ b/custom_components/midea_ac_lan/midea/devices/e2/device.py @@ -1,8 +1,13 @@ import json import logging -from .message import (MessageE2Response, MessageNewProtocolSet, MessagePower, - MessageQuery, MessageSet) +from .message import ( + MessageE2Response, + MessageNewProtocolSet, + MessagePower, + MessageQuery, + MessageSet, +) try: from enum import StrEnum diff --git a/custom_components/midea_ac_lan/midea/devices/e2/message.py b/custom_components/midea_ac_lan/midea/devices/e2/message.py index e7a0234a..a70c6cc9 100644 --- a/custom_components/midea_ac_lan/midea/devices/e2/message.py +++ b/custom_components/midea_ac_lan/midea/devices/e2/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageE2Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/e3/device.py b/custom_components/midea_ac_lan/midea/devices/e3/device.py index 01780192..250076d1 100644 --- a/custom_components/midea_ac_lan/midea/devices/e3/device.py +++ b/custom_components/midea_ac_lan/midea/devices/e3/device.py @@ -1,8 +1,13 @@ import json import logging -from .message import (MessageE3Response, MessageNewProtocolSet, MessagePower, - MessageQuery, MessageSet) +from .message import ( + MessageE3Response, + MessageNewProtocolSet, + MessagePower, + MessageQuery, + MessageSet, +) try: from enum import StrEnum diff --git a/custom_components/midea_ac_lan/midea/devices/e3/message.py b/custom_components/midea_ac_lan/midea/devices/e3/message.py index 135f856d..4b6952a2 100644 --- a/custom_components/midea_ac_lan/midea/devices/e3/message.py +++ b/custom_components/midea_ac_lan/midea/devices/e3/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType NEW_PROTOCOL_PARAMS = { "zero_cold_water": 0x03, diff --git a/custom_components/midea_ac_lan/midea/devices/e6/message.py b/custom_components/midea_ac_lan/midea/devices/e6/message.py index 4d4ea3c8..230e2d5d 100644 --- a/custom_components/midea_ac_lan/midea/devices/e6/message.py +++ b/custom_components/midea_ac_lan/midea/devices/e6/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageE6Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/e8/message.py b/custom_components/midea_ac_lan/midea/devices/e8/message.py index 881a5e6f..6fe81409 100644 --- a/custom_components/midea_ac_lan/midea/devices/e8/message.py +++ b/custom_components/midea_ac_lan/midea/devices/e8/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageE8Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/ea/message.py b/custom_components/midea_ac_lan/midea/devices/ea/message.py index e725e8e6..49347767 100644 --- a/custom_components/midea_ac_lan/midea/devices/ea/message.py +++ b/custom_components/midea_ac_lan/midea/devices/ea/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageEABase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/ec/message.py b/custom_components/midea_ac_lan/midea/devices/ec/message.py index 01619d73..00c4aefe 100644 --- a/custom_components/midea_ac_lan/midea/devices/ec/message.py +++ b/custom_components/midea_ac_lan/midea/devices/ec/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageECBase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/ed/device.py b/custom_components/midea_ac_lan/midea/devices/ed/device.py index d5ed273f..a25872e5 100644 --- a/custom_components/midea_ac_lan/midea/devices/ed/device.py +++ b/custom_components/midea_ac_lan/midea/devices/ed/device.py @@ -1,7 +1,6 @@ import logging -from .message import (MessageEDResponse, MessageNewSet, MessageOldSet, - MessageQuery) +from .message import MessageEDResponse, MessageNewSet, MessageOldSet, MessageQuery try: from enum import StrEnum diff --git a/custom_components/midea_ac_lan/midea/devices/ed/message.py b/custom_components/midea_ac_lan/midea/devices/ed/message.py index bb765b23..e843d8af 100644 --- a/custom_components/midea_ac_lan/midea/devices/ed/message.py +++ b/custom_components/midea_ac_lan/midea/devices/ed/message.py @@ -1,7 +1,6 @@ from enum import IntEnum -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class NewSetTags(IntEnum): diff --git a/custom_components/midea_ac_lan/midea/devices/fa/message.py b/custom_components/midea_ac_lan/midea/devices/fa/message.py index fea37358..6e11a307 100644 --- a/custom_components/midea_ac_lan/midea/devices/fa/message.py +++ b/custom_components/midea_ac_lan/midea/devices/fa/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageFABase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/fb/message.py b/custom_components/midea_ac_lan/midea/devices/fb/message.py index dfe16ced..57e613d9 100644 --- a/custom_components/midea_ac_lan/midea/devices/fb/message.py +++ b/custom_components/midea_ac_lan/midea/devices/fb/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageFBBase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/fc/message.py b/custom_components/midea_ac_lan/midea/devices/fc/message.py index 02eb92f7..db391f8e 100644 --- a/custom_components/midea_ac_lan/midea/devices/fc/message.py +++ b/custom_components/midea_ac_lan/midea/devices/fc/message.py @@ -1,6 +1,5 @@ from ...core.crc8 import calculate -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageFCBase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/fd/message.py b/custom_components/midea_ac_lan/midea/devices/fd/message.py index e173fb3e..39aa6ec1 100644 --- a/custom_components/midea_ac_lan/midea/devices/fd/message.py +++ b/custom_components/midea_ac_lan/midea/devices/fd/message.py @@ -1,6 +1,5 @@ from ...core.crc8 import calculate -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class MessageFDBase(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/x13/message.py b/custom_components/midea_ac_lan/midea/devices/x13/message.py index 248e3e40..fb208a11 100644 --- a/custom_components/midea_ac_lan/midea/devices/x13/message.py +++ b/custom_components/midea_ac_lan/midea/devices/x13/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class Message13Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/x26/message.py b/custom_components/midea_ac_lan/midea/devices/x26/message.py index 95c4aaff..51026d3a 100644 --- a/custom_components/midea_ac_lan/midea/devices/x26/message.py +++ b/custom_components/midea_ac_lan/midea/devices/x26/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class Message26Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/x34/device.py b/custom_components/midea_ac_lan/midea/devices/x34/device.py index 99250d79..76e8f303 100644 --- a/custom_components/midea_ac_lan/midea/devices/x34/device.py +++ b/custom_components/midea_ac_lan/midea/devices/x34/device.py @@ -1,7 +1,12 @@ import logging -from .message import (Message34Response, MessageLock, MessagePower, - MessageQuery, MessageStorage) +from .message import ( + Message34Response, + MessageLock, + MessagePower, + MessageQuery, + MessageStorage, +) try: from enum import StrEnum diff --git a/custom_components/midea_ac_lan/midea/devices/x34/message.py b/custom_components/midea_ac_lan/midea/devices/x34/message.py index e69a2c39..c107acd2 100644 --- a/custom_components/midea_ac_lan/midea/devices/x34/message.py +++ b/custom_components/midea_ac_lan/midea/devices/x34/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class Message34Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea/devices/x40/message.py b/custom_components/midea_ac_lan/midea/devices/x40/message.py index 03843606..fba44d2e 100644 --- a/custom_components/midea_ac_lan/midea/devices/x40/message.py +++ b/custom_components/midea_ac_lan/midea/devices/x40/message.py @@ -1,5 +1,4 @@ -from ...core.message import (MessageBody, MessageRequest, MessageResponse, - MessageType) +from ...core.message import MessageBody, MessageRequest, MessageResponse, MessageType class Message40Base(MessageRequest): diff --git a/custom_components/midea_ac_lan/midea_devices.py b/custom_components/midea_ac_lan/midea_devices.py index a24b61b3..5ad32bd2 100644 --- a/custom_components/midea_ac_lan/midea_devices.py +++ b/custom_components/midea_ac_lan/midea_devices.py @@ -1,9 +1,16 @@ from homeassistant.components.binary_sensor import BinarySensorDeviceClass from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass -from homeassistant.const import (CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, - CONCENTRATION_PARTS_PER_MILLION, PERCENTAGE, - Platform, UnitOfEnergy, UnitOfPower, - UnitOfTemperature, UnitOfTime, UnitOfVolume) +from homeassistant.const import ( + CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + CONCENTRATION_PARTS_PER_MILLION, + PERCENTAGE, + Platform, + UnitOfEnergy, + UnitOfPower, + UnitOfTemperature, + UnitOfTime, + UnitOfVolume, +) from .midea.devices.a1.device import DeviceAttributes as A1Attributes from .midea.devices.ac.device import DeviceAttributes as ACAttributes diff --git a/custom_components/midea_ac_lan/water_heater.py b/custom_components/midea_ac_lan/water_heater.py index b79e09c6..20d3959c 100644 --- a/custom_components/midea_ac_lan/water_heater.py +++ b/custom_components/midea_ac_lan/water_heater.py @@ -1,12 +1,21 @@ import functools as ft import logging -from homeassistant.components.water_heater import (WaterHeaterEntity, - WaterHeaterEntityFeature) -from homeassistant.const import (ATTR_TEMPERATURE, CONF_DEVICE_ID, - CONF_SWITCHES, PRECISION_HALVES, - PRECISION_WHOLE, STATE_OFF, STATE_ON, - Platform, UnitOfTemperature) +from homeassistant.components.water_heater import ( + WaterHeaterEntity, + WaterHeaterEntityFeature, +) +from homeassistant.const import ( + ATTR_TEMPERATURE, + CONF_DEVICE_ID, + CONF_SWITCHES, + PRECISION_HALVES, + PRECISION_WHOLE, + STATE_OFF, + STATE_ON, + Platform, + UnitOfTemperature, +) from .const import DEVICES, DOMAIN from .midea.devices.c3.device import DeviceAttributes as C3Attributes