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.38k stars 330 forks source link

Light status on HA changes automatically without really affecting the lamp #1351

Open macming opened 2 months ago

macming commented 2 months ago

Hello, I've encountered the same problem as #1335 on my custom mesh lamp after I updated to v4.0.5, restore the light.py file from v4.0.4 can solved the problem perfectly. How to resolve the conflict between different versions?Many thanks!

Here's my xiaomi_gateway3.py:

from custom_components.xiaomi_gateway3.core.devices import *

DEVICES = [{
    9754: ["Panasonic", "Floor Lamp", "HHTS2001W"],
    "spec": [
        BaseConv("light", "light", mi="2.p.1"),
        BrightnessConv("brightness", mi="2.p.2"),
        ColorTempKelvin("color_temp", mi="2.p.3"),
    ],
}] + DEVICES
Sergmasharov commented 2 months ago

I have the same problem. Ikea zigbee e12 lamp randomly on-off state in HA. old light.py file solved problem 123

AlexxIT commented 2 months ago

Any brightness or color_temp update will mark light as on state. This is main changes between this 4 and 5 versions https://github.com/AlexxIT/XiaomiGateway3/compare/v4.0.4...v4.0.5

Sergmasharov commented 2 months ago

Yes, but lamp all the time is off. HA changes state randomly.

BeckXuan commented 2 months ago

The same issue, too. I use the Xiaomi light mesh group. It will still report the status of color_temp when it is off. Realted log is as follows.

May  8 18:43:41 Mijia_Hub_V2-3022 user.notice miio_bt[476]: [N][mesh_gateway] mible_mesh_report_states 1883: id = 1372128240, js = {"type":16,"method":"properties_changed","params":[{"did":"1030382664","siid":2,"piid":3,"value":4504},{"did":"103035776","siid":2,"piid":3,"value":4504}]}

Maybe it would be better to additionally mark the light as on state only when brightness updates itself to be greater than zero?

hubpf commented 2 months ago

Hi @AlexxIT

All my lights mentioned at #1321 are having the same issue. Please help to fix.

Thanks

zhang-wenchao commented 1 month ago

I have the same problem, the state of the latest version of the light is wrong.