jghaanstra / com.xiaomi-miio

Homey app to control Mi Home devices that implement the miIO protocol and Xiaomi gateway child devices
GNU General Public License v3.0
456 stars 85 forks source link

xiaomi.airp.cpa4 error when setting fan level #285

Open jon-walton opened 6 days ago

jon-walton commented 6 days ago

With the xiaomi.airp.cpa4, trying to use the card "Set fan level to ..." results in an error:

Cannot read properties of undefined (reading 'siid')

The fan speed on the xiaomi.airp.cpa4 is not a 3 level dropdown like on the card (and the zhimi.airp.vb4 that I also have and works fine), instead it's split into 15 increments (in the mi home app it's representing different room sizes)

For the xiaomi.airp.cpa4 I believe we need to use SIID 9, PIID 11 - favorite-level as outlined here

and this screenshot from the mihome app

Screenshot 2024-11-24 at 7 33 00 PM

Looking through the code, should I be adding favorite-level under mapping_cpa4? here

I can't quite find how to change the card display from a drop down to an integer

Any tips? I'll be happy to work on this and open a pull request

jghaanstra commented 6 days ago

Thanx for reporting, I'll fix it with the next release by adding a different custom capability for this model which is a number slider.