Skip to content

Commit

Permalink
fix lumi.airrtc.tcpecn02 OFF status issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Joee-D committed Jan 31, 2024
1 parent 05bd80c commit 1431109
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions custom_components/xiaomi_gateway3/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,23 @@ class XiaomiClimate(XEntity, ClimateEntity):
_attr_max_temp = 30
_attr_min_temp = 17
_attr_target_temperature_step = 1
_enabled = None
_mode = None

@callback
def async_set_state(self, data: dict):
self._enabled = data.get("power")
self._attr_current_temperature = data.get("current_temp")
self._attr_fan_mode = data.get("fan_mode")
self._attr_hvac_mode = data.get("hvac_mode")
self._mode = data.get("hvac_mode")
# better support HomeKit
# https://github.com/AlexxIT/XiaomiGateway3/issues/707#issuecomment-1099109552
self._attr_hvac_action = ACTIONS.get(self._attr_hvac_mode)
# fix scenes with turned off climate
# https://github.com/AlexxIT/XiaomiGateway3/issues/101#issuecomment-757781988
self._attr_target_temperature = data.get("target_temp", 0)
self._attr_hvac_mode = self._mode if self._enabled else HVACMode.OFF

async def async_update(self):
await self.device_read(self.subscribed_attrs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@
# https://github.com/AlexxIT/XiaomiGateway3/issues/101
"lumi.airrtc.tcpecn02": ["Aqara", "Thermostat S2 CN", "KTWKQ03ES"],
"spec": [
# BoolConv("power", mi="3.1.85", xiaomi="power_status"),
ClimateConv("climate", "climate", mi="14.2.85"),
BoolConv("power", mi="3.1.85"),
Converter("current_temp", mi="3.2.85"),
MapConv("hvac_mode", mi="14.8.85", map={0: "heat", 1: "cool", 15: "off"}),
MapConv("fan_mode", mi="14.10.85", map={
Expand Down

0 comments on commit 1431109

Please sign in to comment.