AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.47k stars 348 forks source link

Mijia Lamp group has bug #1403

Open GavinIves opened 4 months ago

GavinIves commented 4 months ago

Using Mi Home to create a light group, the brightness mapping adjustment for this light group is incorrect. Setting 10% will become 26%, because it is multiplied by 255. I hope this bug can be fixed.

68286: ["Xiaomi", "Light Group", "mijia.light.group3"],
"spec": [
    BaseConv("light", "light", mi="2.p.1", entity={"icon": "mdi:lightbulb-group"}),  # bool
    BrightnessConv("brightness", mi="2.p.2", max=100), 
    ColorTempKelvin("color_temp", mi="2.p.3"),  # uint32, 2700..6500
],
AlexxIT commented 2 months ago

I can't confirm your words. My groups has same model and they works with 65535 maximum. I don't know how we can detect exact maximum for our groups it that case.

GavinIves commented 2 months ago

In my case, I set the brightness of the light group to 1% through the plug-in, but it actually becomes 25.5%, and so on. So I feel that the brightness of the light group has been converted incorrectly. I changed the code of the light group to the above and everything is normal. Is it just my case?

mypal commented 2 months ago

I have the same problem, and it works well when I change the 'max' parameter to 100. This link indicates that the brightness unit is a percentage, with a scope ranging from 1 to 100.

AlexxIT commented 3 days ago

You can write custom converter for your case. I don't know another way for solving this. I have this group with brightness 65535 as maximum.

https://github.com/AlexxIT/XiaomiGateway3/wiki/Converters