Skip to content

Commit 1cb05a3

Browse files
committed
Merge branch 'release/2024.8.1.0'
2 parents 2fdc325 + 3e4a78c commit 1cb05a3

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Diff for: custom_components/xiaomi_miio_airconditioningcompanion/climate.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
)
4040
from homeassistant.core import callback
4141
from homeassistant.exceptions import PlatformNotReady
42-
from homeassistant.helpers.event import async_track_state_change
42+
from homeassistant.helpers.event import async_track_state_change_event
4343
from homeassistant.util.dt import utcnow
4444

4545
_LOGGER = logging.getLogger(__name__)
@@ -64,6 +64,8 @@
6464
ClimateEntityFeature.TARGET_TEMPERATURE
6565
| ClimateEntityFeature.FAN_MODE
6666
| ClimateEntityFeature.SWING_MODE
67+
| ClimateEntityFeature.TURN_OFF
68+
| ClimateEntityFeature.TURN_ON
6769
)
6870

6971
CONF_SENSOR = "target_sensor"
@@ -255,13 +257,15 @@ def __init__(
255257
self._target_temperature = None
256258

257259
if sensor_entity_id:
258-
async_track_state_change(hass, sensor_entity_id, self._async_sensor_changed)
260+
async_track_state_change_event(
261+
hass, sensor_entity_id, self._async_sensor_changed
262+
)
259263
sensor_state = hass.states.get(sensor_entity_id)
260264
if sensor_state:
261265
self._async_update_temp(sensor_state)
262266

263267
if power_sensor_entity_id:
264-
async_track_state_change(
268+
async_track_state_change_event(
265269
hass, power_sensor_entity_id, self._async_power_sensor_changed
266270
)
267271
sensor_state = hass.states.get(power_sensor_entity_id)
@@ -344,7 +348,7 @@ async def async_update(self):
344348
from miio import DeviceException
345349

346350
try:
347-
state = await self.hass.async_add_job(self._device.status)
351+
state = await self.hass.async_add_executor_job(self._device.status)
348352
_LOGGER.debug("Got new state: %s", state)
349353

350354
self._available = True
@@ -542,12 +546,12 @@ async def _send_configuration(self):
542546

543547
async def async_learn_command(self, slot, timeout):
544548
"""Learn a infrared command."""
545-
await self.hass.async_add_job(self._device.learn, slot)
549+
await self.hass.async_add_executor_job(self._device.learn, slot)
546550

547551
_LOGGER.info("Press the key you want Home Assistant to learn")
548552
start_time = utcnow()
549553
while (utcnow() - start_time) < timedelta(seconds=timeout):
550-
message = await self.hass.async_add_job(self._device.learn_result)
554+
message = await self.hass.async_add_executor_job(self._device.learn_result)
551555
# FIXME: Improve python-miio here?
552556
message = message[0]
553557
_LOGGER.debug("Message received from device: '%s'", message)
@@ -557,12 +561,12 @@ async def async_learn_command(self, slot, timeout):
557561
self.hass.components.persistent_notification.async_create(
558562
log_msg, title="Xiaomi Miio Remote"
559563
)
560-
await self.hass.async_add_job(self._device.learn_stop, slot)
564+
await self.hass.async_add_executor_job(self._device.learn_stop, slot)
561565
return
562566

563567
await asyncio.sleep(1)
564568

565-
await self.hass.async_add_job(self._device.learn_stop, slot)
569+
await self.hass.async_add_executor_job(self._device.learn_stop, slot)
566570
_LOGGER.error("Timeout. No infrared command captured")
567571
self.hass.components.persistent_notification.async_create(
568572
"Timeout. No infrared command captured", title="Xiaomi Miio Remote"

Diff for: custom_components/xiaomi_miio_airconditioningcompanion/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"construct==2.10.68",
1414
"python-miio>=0.5.12"
1515
],
16-
"version": "2024.8.0.0"
16+
"version": "2024.8.1.0"
1717
}

0 commit comments

Comments
 (0)