From f3abbef94cfdf9cb4af66cb47114e8de96357384 Mon Sep 17 00:00:00 2001 From: Li Shuzhen Date: Wed, 30 Jul 2025 15:15:28 +0800 Subject: [PATCH] fix: set the device on when the switch status is False or None (#1303) * fix: set the air conditioner on if its switch status property is False or None (#1277) * feat: add a standalone switch for 090615.aircondition.ktf * fix: add an alongside switch for juhl.aircondition.hvac (#1287) --- custom_components/xiaomi_home/climate.py | 2 +- .../xiaomi_home/miot/specs/spec_add.json | 38 +++++++++++++++++++ custom_components/xiaomi_home/water_heater.py | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_home/climate.py b/custom_components/xiaomi_home/climate.py index 5259de5..9d872e3 100644 --- a/custom_components/xiaomi_home/climate.py +++ b/custom_components/xiaomi_home/climate.py @@ -546,7 +546,7 @@ class AirConditioner(FeatureOnOff, FeatureTargetTemperature, f'{self.entity_id}') return # set the device on - if self.get_prop_value(prop=self._prop_on) is False: + if self.get_prop_value(prop=self._prop_on) is not True: await self.set_property_async(prop=self._prop_on, value=True, write_ha_state=False) diff --git a/custom_components/xiaomi_home/miot/specs/spec_add.json b/custom_components/xiaomi_home/miot/specs/spec_add.json index 8d14aec..2a5bba3 100644 --- a/custom_components/xiaomi_home/miot/specs/spec_add.json +++ b/custom_components/xiaomi_home/miot/specs/spec_add.json @@ -1,5 +1,23 @@ { "urn:miot-spec-v2:device:air-conditioner:0000A004:090615-ktf:1": [ + { + "iid": 2, + "type": "urn:miot-spec-v2:service:switch:0000780C:090615-ktf:1", + "description": "AC Switch", + "properties": [ + { + "iid": 1, + "type": "urn:miot-spec-v2:property:on:00000006:090615-ktf:1", + "description": "Switch Status", + "format": "bool", + "access": [ + "read", + "write", + "notify" + ] + } + ] + }, { "iid": 4, "type": "urn:miot-spec-v2:service:environment:0000780A:090615-ktf:1", @@ -24,6 +42,26 @@ ] } ], + "urn:miot-spec-v2:device:air-conditioner:0000A004:juhl-hvac:1": [ + { + "iid": 2, + "type": "urn:miot-spec-v2:service:switch:0000780C:juhl-hvac:1", + "description": "AC Switch", + "properties": [ + { + "iid": 1, + "type": "urn:miot-spec-v2:property:on:00000006:juhl-hvac:1", + "description": "Switch Status", + "format": "bool", + "access": [ + "read", + "write", + "notify" + ] + } + ] + } + ], "urn:miot-spec-v2:device:airer:0000A00D:hyd-lyjpro:1": [ { "iid": 3, diff --git a/custom_components/xiaomi_home/water_heater.py b/custom_components/xiaomi_home/water_heater.py index e28e8ff..7f8f402 100644 --- a/custom_components/xiaomi_home/water_heater.py +++ b/custom_components/xiaomi_home/water_heater.py @@ -168,7 +168,7 @@ class WaterHeater(MIoTServiceEntity, WaterHeaterEntity): if operation_mode == STATE_ON: await self.set_property_async(prop=self._prop_on, value=True) return - if self.get_prop_value(prop=self._prop_on) is False: + if self.get_prop_value(prop=self._prop_on) is not True: await self.set_property_async(prop=self._prop_on, value=True, write_ha_state=False)