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.43k stars 341 forks source link

Mijia Lamp group has bug #1403

Open GavinIves opened 2 months ago

GavinIves commented 2 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 4 weeks 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 3 weeks 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 1 week 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.