Skip to content

Commit 923bbb6

Browse files
authored
HA2024.1.0 patch
1 parent 4be0b88 commit 923bbb6

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

custom_components/midea_dehumidifier/humidifier.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,33 @@
33
For more details please refer to the documentation at
44
https://github.com/barban-dev/midea_inventor_dehumidifier
55
"""
6-
VERSION = '1.0.2'
6+
VERSION = '1.0.4'
77

88
import logging
99
from typing import List, Optional
1010
from custom_components.midea_dehumidifier import DOMAIN, MIDEA_API_CLIENT, MIDEA_TARGET_DEVICE
1111
from homeassistant.const import ATTR_MODE
12-
from homeassistant.components.humidifier import HumidifierEntity
12+
13+
#patch for HA2024.1.0
14+
#from homeassistant.components.humidifier import HumidifierEntity
15+
from homeassistant.components.humidifier import HumidifierEntity, HumidifierDeviceClass, HumidifierEntityFeature
16+
1317
from homeassistant.components.humidifier.const import (
1418
ATTR_AVAILABLE_MODES,
1519
ATTR_HUMIDITY,
1620
ATTR_MAX_HUMIDITY,
1721
ATTR_MIN_HUMIDITY,
1822
DEFAULT_MAX_HUMIDITY,
1923
DEFAULT_MIN_HUMIDITY,
20-
DEVICE_CLASS_DEHUMIDIFIER,
21-
SERVICE_SET_HUMIDITY,
22-
SERVICE_SET_MODE,
23-
SUPPORT_MODES
24+
#patch for HA2024.1.0
25+
#DEVICE_CLASS_DEHUMIDIFIER,
26+
SERVICE_SET_HUMIDITY,
27+
SERVICE_SET_MODE
28+
#SUPPORT_MODES
2429
)
2530

26-
#import asyncio
2731
import voluptuous as vol
2832
import homeassistant.helpers.config_validation as cv
29-
#from homeassistant.helpers import config_validation as cv, entity_platform, service
3033
from homeassistant.helpers import service
3134
from homeassistant.helpers.dispatcher import async_dispatcher_connect, async_dispatcher_send
3235
from homeassistant.core import callback
@@ -58,8 +61,9 @@
5861

5962
_LOGGER = logging.getLogger(__name__)
6063

61-
#SUPPORT_FLAGS = 0
62-
SUPPORT_FLAGS = SUPPORT_MODES
64+
#patch for HA2024.1.0
65+
#SUPPORT_FLAGS = SUPPORT_MODES
66+
SUPPORT_FLAGS = HumidifierEntityFeature.MODES
6367

6468
#TODO: in midea_dehumi python lib the range 30-70 is hard coded (fix it)
6569
MIN_HUMITIDY = 35
@@ -163,12 +167,12 @@ def __init__(self, hass, client, targetDevice):
163167

164168
#Default values for device state
165169
self._powerMode = None # 0:off, 1:on
166-
self._mode = None # device's current mode ['Target_humidity', 'Continuous', 'Smart', 'Dryer']
167-
self._ionSetSwitch = None # 0:off, 1:on
170+
self._mode = None # device's current mode ['Target_humidity', 'Continuous', 'Smart', 'Dryer']
171+
self._ionSetSwitch = None # 0:off, 1:on
168172
self._humidity = None # current humidity
169173
self._humidity_set = None # target hunidity
170174
self._humidity_dot = None # current humidity (decimal)
171-
self._humidity_dot_set = None # target humidity (decimal)
175+
self._humidity_dot_set = None # target humidity (decimal)
172176
self._windSpeed = None # fan speed [1..99]
173177
self._windSpeedMode = None # fan speed mode (Silent:40, Medium:60, High:80)
174178
self._isDisplay = None
@@ -178,7 +182,9 @@ def __init__(self, hass, client, targetDevice):
178182
self._upanddownSwing = None
179183
self._tankShow = False
180184

181-
self._device_class = DEVICE_CLASS_DEHUMIDIFIER
185+
#patch for HA2024.1.0
186+
#self._device_class = DEVICE_CLASS_DEHUMIDIFIER
187+
self._device_class = HumidifierDeviceClass.DEHUMIDIFIER
182188

183189
##Get appliance's status to set initial values for the device
184190
#_LOGGER.debug("midea-client: querying appliance status via Web API...")
@@ -268,8 +274,10 @@ def tank_show(self):
268274
"""Return the tank status """
269275
return self._tankShow
270276

277+
#patch for HA2024.1.0
278+
#def extra_state_attributes(self):
271279
@property
272-
def extra_state_attributes(self):
280+
def device_state_attributes(self):
273281
"""Return entity specific state attributes."""
274282
data = {}
275283

0 commit comments

Comments
 (0)