mill1000 / midea-msmart

Python library for local control of Midea (and associated brands) smart air conditioners.
MIT License
49 stars 2 forks source link

Decode and expose fan speed capabilities #83

Closed mill1000 closed 1 year ago

mill1000 commented 1 year ago

Based on reference code, the fan speed capability can be decoded to indicate which discrete fan speeds are actually supported (and possibly indicate if custom speeds are supported)

mill1000 commented 1 year ago

Of my devices, one is capable of arbitrary fan speeds, the other only supports low, med, high, auto. Their fan speed capabilities are 1 and 5, respectively.

Based on the decoding map from the plugin. I am led to believe that isNopolar property indicates if a fan is capability of arbitrary fan speeds, and otherwise the type array indicates the supported modes.

var windMap = {
    "0": { //-1
        isNopolar: false,
        type: []
    },
    "1": {
        isNopolar: true,
        type: []
    },
    "2": { //-1
        isNopolar: false,
        type: []
    },
    "3": {
        isNopolar: false,
        type: [_Data.CMD.WINDSPEED_LOW, _Data.CMD.WINDSPEED_HIGH]
    },
    "4": {
        isNopolar: false,
        type: [_Data.CMD.WINDSPEED_LOW, _Data.CMD.WINDSPEED_HIGH, _Data.CMD.WINDSPEED_AUTO]
    },
    "5": {
        isNopolar: false,
        type: [_Data.CMD.WINDSPEED_LOW, _Data.CMD.WINDSPEED_MID, _Data.CMD.WINDSPEED_HIGH, _Data.CMD.WINDSPEED_AUTO]
    },
    "6": {
        isNopolar: false,
        type: [_Data.CMD.WINDSPEED_MUTE, _Data.CMD.WINDSPEED_LOW, _Data.CMD.WINDSPEED_MID, _Data.CMD.WINDSPEED_HIGH, _Data.CMD.WINDSPEED_AUTO]
    },
    "7": {
        isNopolar: false,
        type: [_Data.CMD.WINDSPEED_LOW, _Data.CMD.WINDSPEED_MID, _Data.CMD.WINDSPEED_HIGH]
    }
};