Skip to content

Commit

Permalink
Merge branch 'release/2023.6.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Jun 8, 2023
2 parents c26b39c + 8c395af commit d231dfa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 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,7 @@


# pylint: disable=unused-argument
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
async 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 @@ -296,20 +296,20 @@ def _async_update_power_state(self, state):
else:
yield from self.async_turn_off()

def _async_sensor_changed(self, entity_id, old_state, new_state):
async 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)

def _async_power_sensor_changed(self, entity_id, old_state, new_state):
async 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)

def _try_command(self, mask_error, func, *args, **kwargs):
async def _try_command(self, mask_error, func, *args, **kwargs):
"""Call a AC companion command handling error messages."""
from miio import DeviceException

Expand All @@ -324,7 +324,7 @@ def _try_command(self, mask_error, func, *args, **kwargs):
self._available = False
return False

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

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

def async_update(self):
async def async_update(self):
"""Update the state of this climate device."""
from miio import DeviceException

Expand Down Expand Up @@ -466,7 +466,7 @@ def fan_modes(self):

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

def async_set_temperature(self, **kwargs):
async def async_set_temperature(self, **kwargs):
"""Set target temperature."""
if kwargs.get(ATTR_TEMPERATURE) is not None:
self._target_temperature = kwargs.get(ATTR_TEMPERATURE)
Expand All @@ -475,21 +475,21 @@ def async_set_temperature(self, **kwargs):

yield from self._send_configuration()

def async_set_swing_mode(self, swing_mode):
async 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()

def async_set_fan_mode(self, fan_mode):
async 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()

def async_set_hvac_mode(self, hvac_mode):
async def async_set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
if hvac_mode == OperationMode.Off.value:
result = yield from self._try_command(
Expand All @@ -516,7 +516,7 @@ def swing_modes(self):

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

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

def async_learn_command(self, slot, timeout):
async 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 @@ -569,7 +569,7 @@ def async_learn_command(self, slot, timeout):
"Timeout. No infrared command captured", title="Xiaomi Miio Remote"
)

def async_send_command(self, command, **kwargs):
async def async_send_command(self, command, **kwargs):
"""Send a infrared command."""
repeat = kwargs[ATTR_NUM_REPEATS]
delay = kwargs[ATTR_DELAY_SECS]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"construct==2.10.56",
"python-miio>=0.5.12"
],
"version": "2023.6.0.0"
"version": "2023.6.0.1"
}

0 comments on commit d231dfa

Please sign in to comment.