Skip to content

Commit

Permalink
❄️ add miio2miot for zhimi.aircondition.v1 (#2107)
Browse files Browse the repository at this point in the history
  • Loading branch information
al-one committed Dec 19, 2024
1 parent 05d196d commit 8974d62
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
6 changes: 4 additions & 2 deletions custom_components/xiaomi_miot/core/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,14 +1001,16 @@ def set_miot_property(self, siid, piid, value, **kwargs):
cloud_pms = pms
elif self.local:
results = self.local.send('set_properties', [pms])
else:
cloud_pms = pms
if self.cloud and cloud_pms:
results = self.cloud.set_props([pms])
result = MiotResults(results).first
except (DeviceException, MiCloudException) as exc:
self.log.warning('Set miot property %s failed: %s', pms, exc)
return MiotResult({}, code=-1, error=str(exc))
if not result.is_success:
self.log.warning('Set miot property %s failed, result: %s', pms, result)
if not result or not result.is_success:
self.log.warning('Set miot property %s failed, result: %s', pms, [results, m2m])
else:
self.log.info('Set miot property %s, result: %s', pms, result)
result.value = value
Expand Down
6 changes: 6 additions & 0 deletions custom_components/xiaomi_miot/core/device_customizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,12 @@
'number_properties': 'store_timeout',
},

'zhimi.aircondition.v1': {
'switch_properties': 'heater,sleep_mode,horizontal-swing,vertical-swing',
'number_properties': 'vertical-angle,volume,brightness',
'brightness_for_on': 5,
'brightness_for_off': 0,
},
'zhimi.airfresh.*': {
'switch_properties': 'heater,alarm',
},
Expand Down
16 changes: 8 additions & 8 deletions custom_components/xiaomi_miot/core/miio2miot_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2529,7 +2529,7 @@ def cbk(prop, params, props, **kwargs):
'chunk_properties': 1,
'miio_specs': {
'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},
'prop.2.2': {'prop': 'mode', 'dict': {
'prop.2.2': {'prop': 'mode', 'setter': True, 'dict': {
'automode': 0,
'cooling': 1,
'arefaction': 2,
Expand All @@ -2545,12 +2545,12 @@ def cbk(prop, params, props, **kwargs):
'prop.2.4': {'prop': 'ptc', 'setter': True, 'format': 'onoff'},
'prop.2.5': {'prop': 'silent', 'setter': True, 'format': 'onoff'},
'prop.3.1': {'prop': 'speed_level', 'setter': 'set_spd_level', 'dict': {
0: 1,
1: 2,
2: 3,
3: 4,
4: 5,
5: 0, # auto
0: 4, # quiet
1: 1, # low
2: 2, # medium
3: 3, # high
4: 5, # turbo
5: 0, # auto
}},
'prop.3.2': {'prop': 'vertical_swing', 'setter': 'set_vertical', 'format': 'onoff'},
'prop.3.3': {'prop': 'vertical_rt', 'setter': 'set_ver_pos'},
Expand All @@ -2572,7 +2572,7 @@ def cbk(prop, params, props, **kwargs):
'chunk_properties': 1,
'miio_specs': {
'prop.2.1': {'prop': 'power', 'setter': True, 'format': 'onoff'},
'prop.2.2': {'prop': 'mode', 'dict': {
'prop.2.2': {'prop': 'mode', 'setter': True, 'dict': {
'cooling': 1,
'arefaction': 2,
'heat': 3,
Expand Down
18 changes: 18 additions & 0 deletions custom_components/xiaomi_miot/core/miot_specs_extend.json
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,24 @@
}
],

"zhimi.aircondition.v1": [
{
"iid": 1,
"properties": [
{
"iid": 1,
"value-list": [
{"value": 0, "description": "Auto"},
{"value": 1, "description": "Low"},
{"value": 2, "description": "Medium"},
{"value": 3, "description": "High"},
{"value": 4, "description": "Quiet"},
{"value": 5, "description": "Turbo"}
]
}
]
}
],
"zhimi.airfresh.va4":[
{
"iid": 2,
Expand Down

0 comments on commit 8974d62

Please sign in to comment.