hillaliy / homebridge-midea-air

Homebridge plugin for Midea units
MIT License
71 stars 23 forks source link

Support for the "Tilting Mechanisms" characteristic #88

Closed cheung31 closed 2 years ago

cheung31 commented 2 years ago

I was looking at HMCharacteristic documentation, and noticed there are Tilting Mechanisms that could be utilized to have the AC unit's direction be mapped to these characteristics. See: https://developer.apple.com/documentation/homekit/hmcharacteristic/characteristic_types

image

FYI, I have the following AC unit: https://www.midea.com/ca/air-conditioners/portable-air-conditioners/14000-btu-12000-btu-sacc-duo-smart-inverter-3-in-1-portable-air-conditioner-mp12svwba3rcm

And in the Midea app, there's the "Direction" setting: image

Is this possible? I may try to investigate myself.

hillaliy commented 2 years ago

It's already included in this plugin. Enter device settings and you will see it. Swing Mode

cheung31 commented 2 years ago

It's already included in this plugin. Enter device settings and you will see it. Swing Mode

Ok I see, but I think this HMCharacteristicTypeCurrentTilt trait is separate from HMCharacteristicTypeSwingMode (where it controls "Oscillate").

I'm assuming HMCharacteristicTypeCurrentTilt will allow to control the rotation to a specific angle, as seen in the Midea app: image

cheung31 commented 2 years ago

I tried logging the data property on ApplianceResponse and see the diff when going from the Vertical Swing, Fully Up to Vertical Swing, Fully Down direction. This was the result:

Screen Shot 2022-07-28 at 7 46 45 PM
Vertical Swing, Fully Up Vertical Swing, Fully Down
[ [
90, 90, 1, 0, 92, 0, 32, 128, 80, 0, 0, 0, 90, 90, 1, 0, 92, 0, 32, 128, 80, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 234, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 234, 5, 3, 0,
0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 170, 35, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, 35, 172, 0, 0, 0, 0, 0,
3, 3, 192, 1, 40, 102, 127, 127, 0, 48, 0, 0, 3, 3, 192, 1, 40, 102, 127, 127, 0, 48, 0, 0,
0, 101, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 3, 235, 214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 83, 109, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0 0, 0, 0, 0
] ]

Not sure if this helps narrow down which segment of the data array maps to the Direction. Let me know if there are other ways to identify what byte maps to the Direction/Angle of the Swing.

cheung31 commented 2 years ago

Did more digging, and looks like bytes 11 / 12 (after header segment) map to indoor temp / outdoor temp respectively according to: https://github.com/mac-zhou/midea-msmart/blob/97723d055d8e5a3775eaaca96807f2dbbd6db2aa/msmart/device/AC/command.py#L470-L472

I did the math, and it checks out. Will keep spot checking for any other differences that may be a clue about Direction/Angle.

Which leaves bytes 23/24/25 as the other non-zero ones to look into.

cheung31 commented 2 years ago

I just realized the Homebridge Fanv2 service doesn't even support any of the Tilt characteristics, so never mind. 😓

cheung31 commented 2 years ago

I suppose you'd have to add the Slat service to use Tilt characteristics: https://developers.homebridge.io/#/service/Slats

metaljay commented 2 years ago

I suppose you'd have to add the Slat service to use Tilt characteristics: https://developers.homebridge.io/#/service/Slats

any ideas what this would look like within Homebridge? ive yet to see any plugin with this implemented

hillaliy commented 2 years ago

I'll check it

hillaliy commented 2 years ago

Hi I can't add Slat support because I don't have Midea response [Current Slat State] command for this.