3
3
For more details please refer to the documentation at
4
4
https://github.com/barban-dev/midea_inventor_dehumidifier
5
5
"""
6
- VERSION = '1.0.2 '
6
+ VERSION = '1.0.4 '
7
7
8
8
import logging
9
9
from typing import List , Optional
10
10
from custom_components .midea_dehumidifier import DOMAIN , MIDEA_API_CLIENT , MIDEA_TARGET_DEVICE
11
11
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
+
13
17
from homeassistant .components .humidifier .const import (
14
18
ATTR_AVAILABLE_MODES ,
15
19
ATTR_HUMIDITY ,
16
20
ATTR_MAX_HUMIDITY ,
17
21
ATTR_MIN_HUMIDITY ,
18
22
DEFAULT_MAX_HUMIDITY ,
19
23
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
24
29
)
25
30
26
- #import asyncio
27
31
import voluptuous as vol
28
32
import homeassistant .helpers .config_validation as cv
29
- #from homeassistant.helpers import config_validation as cv, entity_platform, service
30
33
from homeassistant .helpers import service
31
34
from homeassistant .helpers .dispatcher import async_dispatcher_connect , async_dispatcher_send
32
35
from homeassistant .core import callback
58
61
59
62
_LOGGER = logging .getLogger (__name__ )
60
63
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
63
67
64
68
#TODO: in midea_dehumi python lib the range 30-70 is hard coded (fix it)
65
69
MIN_HUMITIDY = 35
@@ -163,12 +167,12 @@ def __init__(self, hass, client, targetDevice):
163
167
164
168
#Default values for device state
165
169
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
168
172
self ._humidity = None # current humidity
169
173
self ._humidity_set = None # target hunidity
170
174
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)
172
176
self ._windSpeed = None # fan speed [1..99]
173
177
self ._windSpeedMode = None # fan speed mode (Silent:40, Medium:60, High:80)
174
178
self ._isDisplay = None
@@ -178,7 +182,9 @@ def __init__(self, hass, client, targetDevice):
178
182
self ._upanddownSwing = None
179
183
self ._tankShow = False
180
184
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
182
188
183
189
##Get appliance's status to set initial values for the device
184
190
#_LOGGER.debug("midea-client: querying appliance status via Web API...")
@@ -268,8 +274,10 @@ def tank_show(self):
268
274
"""Return the tank status """
269
275
return self ._tankShow
270
276
277
+ #patch for HA2024.1.0
278
+ #def extra_state_attributes(self):
271
279
@property
272
- def extra_state_attributes (self ):
280
+ def device_state_attributes (self ):
273
281
"""Return entity specific state attributes."""
274
282
data = {}
275
283
0 commit comments