Skip to content

Commit

Permalink
Merge branch 'release/2023.6.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Jun 8, 2023
2 parents 62fb653 + fb84f41 commit c26b39c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
14 changes: 0 additions & 14 deletions custom_components/xiaomi_miio_airconditioningcompanion/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@


# pylint: disable=unused-argument
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the air conditioning companion from config."""
from miio import AirConditioningCompanion, DeviceException
Expand Down Expand Up @@ -297,22 +296,19 @@ def _async_update_power_state(self, state):
else:
yield from self.async_turn_off()

@asyncio.coroutine
def _async_sensor_changed(self, entity_id, old_state, new_state):
"""Handle temperature changes."""
if new_state is None:
return
self._async_update_temp(new_state)

@asyncio.coroutine
def _async_power_sensor_changed(self, entity_id, old_state, new_state):
"""Handle power sensor changes."""
if new_state is None:
return

yield from self._async_update_power_state(new_state)

@asyncio.coroutine
def _try_command(self, mask_error, func, *args, **kwargs):
"""Call a AC companion command handling error messages."""
from miio import DeviceException
Expand All @@ -328,7 +324,6 @@ def _try_command(self, mask_error, func, *args, **kwargs):
self._available = False
return False

@asyncio.coroutine
def async_turn_on(self, speed: str = None, **kwargs) -> None:
"""Turn the miio device on."""
result = yield from self._try_command(
Expand All @@ -338,7 +333,6 @@ def async_turn_on(self, speed: str = None, **kwargs) -> None:
if result:
self._state = True

@asyncio.coroutine
def async_turn_off(self, **kwargs) -> None:
"""Turn the miio device off."""
result = yield from self._try_command(
Expand All @@ -348,7 +342,6 @@ def async_turn_off(self, **kwargs) -> None:
if result:
self._state = False

@asyncio.coroutine
def async_update(self):
"""Update the state of this climate device."""
from miio import DeviceException
Expand Down Expand Up @@ -473,7 +466,6 @@ def fan_modes(self):

return [speed.name.lower() for speed in FanSpeed]

@asyncio.coroutine
def async_set_temperature(self, **kwargs):
"""Set target temperature."""
if kwargs.get(ATTR_TEMPERATURE) is not None:
Expand All @@ -483,23 +475,20 @@ def async_set_temperature(self, **kwargs):

yield from self._send_configuration()

@asyncio.coroutine
def async_set_swing_mode(self, swing_mode):
"""Set the swing mode."""
from miio.airconditioningcompanion import SwingMode

self._swing_mode = SwingMode[swing_mode.title()]
yield from self._send_configuration()

@asyncio.coroutine
def async_set_fan_mode(self, fan_mode):
"""Set the fan mode."""
from miio.airconditioningcompanion import FanSpeed

self._fan_mode = FanSpeed[fan_mode.title()]
yield from self._send_configuration()

@asyncio.coroutine
def async_set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
if hvac_mode == OperationMode.Off.value:
Expand Down Expand Up @@ -527,7 +516,6 @@ def swing_modes(self):

return [mode.name.lower() for mode in SwingMode]

@asyncio.coroutine
def _send_configuration(self):
from miio.airconditioningcompanion import Led
from miio.airconditioningcompanion import OperationMode as MiioOperationMode
Expand All @@ -553,7 +541,6 @@ def _send_configuration(self):
"Configuration cannot be sent."
)

@asyncio.coroutine
def async_learn_command(self, slot, timeout):
"""Learn a infrared command."""
yield from self.hass.async_add_job(self._device.learn, slot)
Expand Down Expand Up @@ -582,7 +569,6 @@ def async_learn_command(self, slot, timeout):
"Timeout. No infrared command captured", title="Xiaomi Miio Remote"
)

@asyncio.coroutine
def async_send_command(self, command, **kwargs):
"""Send a infrared command."""
repeat = kwargs[ATTR_NUM_REPEATS]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"domain": "xiaomi_miio_airconditioningcompanion",
"name": "Xiaomi Mi and Aqara Air Conditioning Companion",
"codeowners": [
"@syssi"
],
"config_flow": false,
"version": "2022.8.0.0",
"iot_class": "local_polling",
"dependencies": ["sensor"],
"documentation": "https://github.com/syssi/xiaomi_airconditioningcompanion",
"iot_class": "local_polling",
"issue_tracker": "https://github.com/syssi/xiaomi_airconditioningcompanion/issues",
"requirements": [
"construct==2.10.56",
"python-miio>=0.5.12"
],
"dependencies": ["sensor"],
"codeowners": [
"@syssi"
]
"version": "2023.6.0.0"
}

0 comments on commit c26b39c

Please sign in to comment.