Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Switch ON doesn't work in HA but perfectly in MiJia App. Switch OFF + brightness + color works from HA. #1459

Open
sulliwane opened this issue Sep 25, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@sulliwane
Copy link

I have Xiaomi Gateway 3 integration installed:
image

I have this mijia bluetooth mesh bulb (bluetooth signal is strong):
image
Screenshot_2024-09-25-10-49-03-22_89ed83f5c7ca8fa2c91fc75c50289338

My issue is that switching on/off from the MiJia App works reliably. but from the HA integration it doesn't (or it seems only switch off works, not switch on). Here is the HA logs of when I switch on the bulb from HA:

2024-09-25T08:44:05.739692000Z 2024-09-25 10:44:05.734 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'write', 'data': {'brightness': 196, 'color_temp': 211, 'color_temp_kelvin': 4735}}
2024-09-25T08:44:05.750973000Z 2024-09-25 10:44:05.744 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/command', 'data': b'{"method":"set_properties","params":[{"did":"1005245900","siid":2,"piid":2,"value":77},{"did":"1005245900","siid":2,"piid":3,"value":4739}]}'}
2024-09-25T08:44:05.761672000Z 2024-09-25 10:44:05.746 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/command_ack', 'data': b'{"id":0,"result":[{"did":"1005245900","siid":2,"piid":2,"code":1,"ts":1727253223,"ret":0},{"did":"1005245900","siid":2,"piid":3,"code":1,"ts":1727253223,"ret":0}]}'}
2024-09-25T08:44:05.810254000Z 2024-09-25 10:44:05.797 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'central/report', 'data': b'{"id":1582807393,"_to":128,"type":16,"method":"properties_changed","params":[{"did":"1005245900","siid":2,"piid":2,"value":77}]}'}
2024-09-25T08:44:05.830866000Z 2024-09-25 10:44:05.801 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'on_report', 'data': {'brightness': 196.35}}
2024-09-25T08:44:05.862422000Z 2024-09-25 10:44:05.856 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report', 'data': b'{"id":72710492,"method":"properties_changed","params":[{"did":"1005245900","siid":2,"piid":2,"value":77}],"type":16}'}
2024-09-25T08:44:05.868004000Z 2024-09-25 10:44:05.857 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'on_report', 'data': {'brightness': 196.35}}
2024-09-25T08:44:06.047367000Z 2024-09-25 10:44:06.044 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report_ack', 'data': b'{"id":72710492,"result":"ok"}'}
2024-09-25T08:44:06.159647000Z 2024-09-25 10:44:06.149 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'central/report', 'data': b'{"id":780066394,"_to":128,"type":16,"method":"properties_changed","params":[{"did":"1005245900","siid":2,"piid":3,"value":4739}]}'}
2024-09-25T08:44:06.162205000Z 2024-09-25 10:44:06.150 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'on_report', 'data': {'color_temp': 211}}
2024-09-25T08:44:06.408433000Z 2024-09-25 10:44:06.404 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report', 'data': b'{"id":2146297493,"method":"_async.stat","params":{"version":1,"btstat_props":[{"did":"1005245900","siid":2,"aiid":0,"piid":2,"control_type":2,"from":"","rpc_addr":0,"control_times":1,"total":100,"cost":100,"ret":0,"result":0},{"did":"1005245900","siid":2,"aiid":0,"piid":3,"control_type":2,"from":"","rpc_addr":0,"control_times":2,"total":400,"cost":200,"ret":0,"result":0}]}}'}
2024-09-25T08:44:06.415800000Z 2024-09-25 10:44:06.410 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report', 'data': b'{"id":1901131494,"method":"properties_changed","params":[{"did":"1005245900","siid":2,"piid":3,"value":4739}],"type":16}'}
2024-09-25T08:44:06.419388000Z 2024-09-25 10:44:06.412 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'on_report', 'data': {'color_temp': 211}}
2024-09-25T08:44:06.456423000Z 2024-09-25 10:44:06.451 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'central/report', 'data': b'{"id":2140195396,"_to":128,"type":16,"method":"properties_changed","params":[{"did":"1005245900","siid":2,"piid":2,"value":15}]}'}
2024-09-25T08:44:06.458882000Z 2024-09-25 10:44:06.452 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'on_report', 'data': {'brightness': 38.25}}
2024-09-25T08:44:06.609034000Z 2024-09-25 10:44:06.605 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report_ack', 'data': b'{"id":2146297493,"result":"ok"}'}
2024-09-25T08:44:06.758945000Z 2024-09-25 10:44:06.751 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'central/report', 'data': b'{"id":1331393397,"_to":128,"type":16,"method":"properties_changed","params":[{"did":"1005245900","siid":2,"piid":3,"value":2702}]}'}
2024-09-25T08:44:06.763781000Z 2024-09-25 10:44:06.753 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'on_report', 'data': {'color_temp': 370}}
2024-09-25T08:44:06.778108000Z 2024-09-25 10:44:06.773 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report_ack', 'data': b'{"id":1901131494,"result":"ok"}'}
2024-09-25T08:44:06.961250000Z 2024-09-25 10:44:06.955 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report', 'data': b'{"id":490774495,"method":"properties_changed","params":[{"did":"1005245900","siid":2,"piid":2,"value":15},{"did":"1005245900","siid":2,"piid":3,"value":2702}],"type":16}'}
2024-09-25T08:44:06.966183000Z 2024-09-25 10:44:06.956 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'on_report', 'data': {'brightness': 38.25, 'color_temp': 370}}
2024-09-25T08:44:07.146801000Z 2024-09-25 10:44:07.143 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report', 'data': b'{"id":587993496,"method":"_sync.stat","params":{"btstat_mesh_seq":[{"reason":1,"did":"1005245900","uni_addr":26,"ele_num":2,"ele_addr":27,"iv_index":0,"seq_num":113314,"last_seq":113164,"rollback_seq":0,"ttl":5,"time":1727253845}]}}'}
2024-09-25T08:44:07.154029000Z 2024-09-25 10:44:07.150 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report_ack', 'data': b'{"id":490774495,"result":"ok"}'}
2024-09-25T08:44:07.327331000Z 2024-09-25 10:44:07.324 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report_ack', 'data': b'{"id":587993496,"result":"{}"}'}

And here is log when I switch off from HA (and it works):

2024-09-25T08:54:00.008872000Z 2024-09-25 10:54:00.005 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'write', 'data': {'light': False}}
2024-09-25T08:54:00.021096000Z 2024-09-25 10:54:00.016 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/command', 'data': b'{"method":"set_properties","params":[{"did":"1005245900","siid":2,"piid":1,"value":false}]}'}
2024-09-25T08:54:00.024841000Z 2024-09-25 10:54:00.017 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/command_ack', 'data': b'{"id":0,"result":[{"did":"1005245900","siid":2,"piid":1,"code":1,"ts":1727254437,"ret":0}]}'}
2024-09-25T08:54:00.092756000Z 2024-09-25 10:54:00.084 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'central/report', 'data': b'{"id":2036781015,"_to":128,"type":16,"method":"properties_changed","params":[{"did":"1005245900","siid":2,"piid":1,"value":false}]}'}
2024-09-25T08:54:00.097922000Z 2024-09-25 10:54:00.086 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'on_report', 'data': {'light': False}}
2024-09-25T08:54:00.201313000Z 2024-09-25 10:54:00.196 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report', 'data': b'{"id":724909606,"method":"properties_changed","params":[{"did":"1005245900","siid":2,"piid":1,"value":false}],"type":16}'}
2024-09-25T08:54:00.203716000Z 2024-09-25 10:54:00.197 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.192.168.1.10] {'uid': 'dced838ef7d1', 'did': '1005245900', 'msg': 'on_report', 'data': {'light': False}}
2024-09-25T08:54:00.390553000Z 2024-09-25 10:54:00.386 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report_ack', 'data': b'{"id":724909606,"result":"ok"}'}

2024-09-25T08:54:02.400486000Z 2024-09-25 10:54:02.396 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report', 'data': b'{"id":1144514607,"method":"_async.stat","params":{"version":1,"btstat_props":[{"did":"1005245900","siid":2,"aiid":0,"piid":1,"control_type":2,"from":"","rpc_addr":0,"control_times":1,"total":0,"cost":0,"ret":0,"result":0}]}}'}
2024-09-25T08:54:02.590908000Z 2024-09-25 10:54:02.587 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'miio/report_ack', 'data': b'{"id":1144514607,"result":"ok"}'}
2024-09-25T08:54:14.432197000Z 2024-09-25 10:54:14.416 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.10] {'topic': 'openmiio/report', 'data': b'{"gateway":{"firmware":"1.0.7_0021","model":"lumi.gateway.mcn001"},"miio":{"cloud_starts":2,"cloud_state":"cloud_connected","cloud_uptime":"31m51s"},"openmiio":{"uptime":"49m2s","version":"1.2.1"},"serial":{"bluetooth_rx":8799051,"bluetooth_tx":1174318,"zigbee_rx":6000,"zigbee_tx":5649},"zigbee":{"z3_starts":1,"z3_uptime":"49m1s"}}'}

Any idea what is causing this issue?

Thanks a lot for you help! 🙏

@sulliwane
Copy link
Author

Note:

To me it seems logs are missing "On" Command:

The key issue seems to be the absence of an explicit "on" command ({"did":"1005245900","siid":2,"piid":1,"value":true}).

The system is sending brightness and color temperature adjustments, which typically occur after the light is turned on, but without the on command, the light may not actually power on.

The light may be receiving the brightness and color temperature settings, but it is likely still off because the actual "on" signal isn’t being sent...

Indeed setting color and brightness from HA works perfectly fine.

@sulliwane sulliwane changed the title [BUG] Switch on doesn't work in HA but perfectly in MiJia App [BUG] Switch ON doesn't work in HA but perfectly in MiJia App. Switch OFF + brightness + color works from HA. Sep 25, 2024
@AlexxIT AlexxIT added the bug Something isn't working label Sep 25, 2024
@AlexxIT AlexxIT self-assigned this Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants