Let me paste my debug:
root@raspberrypi:~# tail -28 /home/homeassistant/.homeassistant/home-assistant.log | grep xiaomi_gateway
2019-01-09 22:47:21 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd >> b’{“sid”: “7811dcf9aab4”, “data”: {“rgb”: 1694498815, “key”: “a1ad44a401b80633340da4e57528335e”}, “cmd”: “write”}’
2019-01-09 22:47:21 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd resp << {‘sid’: ‘7811dcf9aab4’, ‘data’: ‘{“error”:“Invalid key”}’, ‘cmd’: ‘write_ack’}
2019-01-09 22:47:21 DEBUG (Thread-6) [xiaomi_gateway] write_ack << {‘sid’: ‘7811dcf9aab4’, ‘data’: ‘{“error”:“Invalid key”}’, ‘cmd’: ‘write_ack’}
2019-01-09 22:47:21 ERROR (Thread-6) [xiaomi_gateway] Got error element in data {“error”:“Invalid key”}
2019-01-09 22:47:21 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd >> b’{“cmd” : “get_id_list”}’
2019-01-09 22:47:21 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd resp << {‘sid’: ‘7811dcf9aab4’, ‘token’: ‘kckhdefSraHCZTwE’, ‘data’: ‘[“158d0002494a60”,“158d00024c2600”,“158d000204c017”,“158d00023d0ab5”,“158d00024da145”,“158d00020f84bf”]’, ‘cmd’: ‘get_id_list_ack’}
2019-01-09 22:47:21 DEBUG (Thread-6) [xiaomi_gateway] get_id_list << {‘sid’: ‘7811dcf9aab4’, ‘token’: ‘kckhdefSraHCZTwE’, ‘data’: ‘[“158d0002494a60”,“158d00024c2600”,“158d000204c017”,“158d00023d0ab5”,“158d00024da145”,“158d00020f84bf”]’, ‘cmd’: ‘get_id_list_ack’}
2019-01-09 22:47:21 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd >> b’{“sid”: “7811dcf9aab4”, “data”: {“rgb”: 1694498815, “key”: “6632cd859373b905c89c9b285c3018db”}, “cmd”: “write”}’
2019-01-09 22:47:21 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd resp << {‘short_id’: 0, ‘sid’: ‘7811dcf9aab4’, ‘data’: ‘{“rgb”:1694498815,“illumination”:452,“proto_version”:“1.1.2”}’, ‘model’: ‘gateway’, ‘cmd’: ‘write_ack’}
2019-01-09 22:47:21 DEBUG (Thread-6) [xiaomi_gateway] write_ack << {‘short_id’: 0, ‘sid’: ‘7811dcf9aab4’, ‘data’: ‘{“rgb”:1694498815,“illumination”:452,“proto_version”:“1.1.2”}’, ‘model’: ‘gateway’, ‘cmd’: ‘write_ack’}
2019-01-09 22:49:30 DEBUG (Thread-20) [xiaomi_gateway] _send_cmd >> b’{“sid”: “7811dcf9aab4”, “data”: {“rgb”: 1694498815, “key”: “6632cd859373b905c89c9b285c3018db”}, “cmd”: “write”}’
As I understand from the log, key is changing continously, but look at the first two lines, at the command response I get the first invalid key (that’s when I switch off the light through HA webpage).
Any idea of how to troubleshoot deeper?
Thanks in advance.