Miio platform broken after upgrade 0.62

Please enable debug output and provide some detailed logs:

logger:
  default: warn
  logs:
    homeassistant.components.light.xiaomi_miio: debug
    homeassistant.components.remote.xiaomi_miio: debug
    miio: debug

Ok, turned on the logging. Remote is working though, I made a mistake in some IR commands, I think.
The following seems to be repeating :

2018-02-26 21:12:56 INFO (MainThread) [homeassistant.components.light.xiaomi_miio] Initializing with host 192.168.100.15 (token 4392b…)
2018-02-26 21:12:56 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’
2018-02-26 21:12:56 DEBUG (MainThread) [miio.device] Got a response: Container:
data = Container:
length = 0
value = (total 0)
offset1 = 32
offset2 = 32
data = (total 0)
header = Container:
length = 16
value = Container:
length = 32
unknown = 0
device_id = \x03\xb0\xd0v (total 4)
ts = 1970-01-01 04:38:51
offset1 = 0
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x03\xb0\xd0v\x00\x00A[ (total 16)
checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 21:12:56 DEBUG (MainThread) [miio.device] Discovered 03b0d076 with ts: 1970-01-01 04:38:51, token: b’00000000000000000000000000000000’
2018-02-26 21:12:56 DEBUG (MainThread) [miio.device] 192.168.100.15:54321 >>: {‘id’: 1, ‘method’: ‘miIO.info’, ‘params’: }
2018-02-26 21:12:56 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’

some decryption error of some sort ?

This line is normal:

2018-02-26 21:12:56 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’‘

The messages after

2018-02-26 21:12:56 DEBUG (MainThread) [miio.device] 192.168.100.15:54321 >>: {‘id’: 1, ‘method’: ‘miIO.info’, ‘params’: []}
2018-02-26 21:12:56 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’

would be important. Does the plug respond on the miIO.info request?

If this is too specific, I’m willing to open my own post.
Anyway. Here’s a bigger log chunk :

2018-02-26 21:12:56 DEBUG (MainThread) [miio.device] Got a response: Container:
data = Container:
length = 0
value = (total 0)
offset1 = 32
offset2 = 32
data = (total 0)
header = Container:
length = 16
value = Container:
length = 32
unknown = 0
device_id = \x03\xb0\xd0v (total 4)
ts = 1970-01-01 04:38:51
offset1 = 0
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x03\xb0\xd0v\x00\x00A[ (total 16)
checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 21:12:56 DEBUG (MainThread) [miio.device] Discovered 03b0d076 with ts: 1970-01-01 04:38:51, token: b’00000000000000000000000000000000’
2018-02-26 21:12:56 DEBUG (MainThread) [miio.device] 192.168.100.15:54321 >>: {‘id’: 1, ‘method’: ‘miIO.info’, ‘params’: }
2018-02-26 21:12:56 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’
2018-02-26 21:12:56 WARNING (MainThread) [homeassistant.components.light] Platform xiaomi_miio not ready yet. Retrying in 30 seconds.
2018-02-26 21:12:57 INFO (MainThread) [homeassistant.components.remote.xiaomi_miio] Initializing with host 192.168.100.12 (token 775bf…)
2018-02-26 21:12:57 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’
2018-02-26 21:12:57 DEBUG (MainThread) [miio.device] Got a response: Container:
data = Container:
length = 0
value = (total 0)
offset1 = 32
offset2 = 32
data = (total 0)
header = Container:
length = 16
value = Container:
length = 32
unknown = 0
device_id = \x03\xef\xa0\xdd (total 4)
ts = 1970-01-17 04:06:30
offset1 = 0
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x03\xef\xa0\xdd\x00\x15Q\xc6 (total 16)
checksum = w[\xfd\xd4<,\xb0\xce\xec+\xdb’?\x92\x80e (total 16)
2018-02-26 21:12:57 DEBUG (MainThread) [miio.device] Discovered 03efa0dd with ts: 1970-01-17 04:06:30, token: b’775bfdd43c2cb0ceec2bdb273f928065’
2018-02-26 21:12:57 DEBUG (MainThread) [miio.device] 192.168.100.12:54321 >>: {‘id’: 1, ‘method’: ‘miIO.info’, ‘params’: }
2018-02-26 21:12:57 DEBUG (MainThread) [miio.device] 192.168.100.12:54321 (ts: 1970-01-17 04:06:30, id: 1) << {‘id’: 1, ‘result’: {‘cfg_time’: 0, ‘otu_stat’: [354, 334, 239, 0, 237, 2976], ‘wifi_fw_ver’: ‘SD878x-14.76.36.p79-702.1.0-WM’, ‘ap’: {‘ssid’: ‘MAXSTUDY’, ‘bssid’: ‘50:46:5D:6D:B1:78’, ‘rssi’: -62}, ‘ott_stat’: [13, 6, 406, 336], ‘token’: ‘775bfdd43c2cb0ceec2bdb273f928065’, ‘mac’: ‘34:CE:00:CE:AD:78’, ‘hw_ver’: ‘MC200’, ‘mmfree’: 45984, ‘netif’: {‘gw’: ‘192.168.100.1’, ‘localIp’: ‘192.168.100.12’, ‘mask’: ‘255.255.255.0’}, ‘fw_ver’: ‘1.2.4_38’, ‘ot’: ‘ott’, ‘life’: 1397190, ‘model’: ‘chuangmi.ir.v2’}}
2018-02-26 21:12:57 DEBUG (MainThread) [miio.device] 192.168.100.12:54321 >>: {‘id’: 2, ‘method’: ‘miIO.info’, ‘params’: }
2018-02-26 21:12:57 DEBUG (MainThread) [miio.device] 192.168.100.12:54321 (ts: 1970-01-17 04:06:30, id: 2) << {‘id’: 2, ‘result’: {‘cfg_time’: 0, ‘otu_stat’: [354, 334, 239, 0, 237, 2976], ‘wifi_fw_ver’: ‘SD878x-14.76.36.p79-702.1.0-WM’, ‘ap’: {‘ssid’: ‘MAXSTUDY’, ‘bssid’: ‘50:46:5D:6D:B1:78’, ‘rssi’: -63}, ‘ott_stat’: [13, 6, 406, 336], ‘token’: ‘775bfdd43c2cb0ceec2bdb273f928065’, ‘mac’: ‘34:CE:00:CE:AD:78’, ‘hw_ver’: ‘MC200’, ‘mmfree’: 45328, ‘netif’: {‘gw’: ‘192.168.100.1’, ‘localIp’: ‘192.168.100.12’, ‘mask’: ‘255.255.255.0’}, ‘fw_ver’: ‘1.2.4_38’, ‘ot’: ‘ott’, ‘life’: 1397190, ‘model’: ‘chuangmi.ir.v2’}}
2018-02-26 21:13:13 WARNING (Thread-14) [netdisco.ssdp] Error fetching description at http://192.168.100.27:8907/rootdesc.xml
2018-02-26 21:13:27 INFO (MainThread) [homeassistant.components.light.xiaomi_miio] Initializing with host 192.168.100.15 (token 4392b…)
2018-02-26 21:13:27 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’
2018-02-26 21:13:27 DEBUG (MainThread) [miio.device] Got a response: Container:
data = Container:
length = 0
value = (total 0)
offset1 = 32
offset2 = 32
data = (total 0)
header = Container:
length = 16
value = Container:
length = 32
unknown = 0
device_id = \x03\xb0\xd0v (total 4)
ts = 1970-01-01 04:39:21
offset1 = 0
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x03\xb0\xd0v\x00\x00Ay (total 16)
checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 21:13:27 DEBUG (MainThread) [miio.device] Discovered 03b0d076 with ts: 1970-01-01 04:39:21, token: b’00000000000000000000000000000000’
2018-02-26 21:13:27 DEBUG (MainThread) [miio.device] 192.168.100.15:54321 >>: {‘id’: 1, ‘method’: ‘miIO.info’, ‘params’: }
2018-02-26 21:13:27 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’
2018-02-26 21:13:27 WARNING (MainThread) [homeassistant.components.light] Platform xiaomi_miio not ready yet. Retrying in 60 seconds.
2018-02-26 21:14:28 INFO (MainThread) [homeassistant.components.light.xiaomi_miio] Initializing with host 192.168.100.15 (token 4392b…)
2018-02-26 21:14:28 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’
2018-02-26 21:14:28 DEBUG (MainThread) [miio.device] Got a response: Container:
data = Container:
length = 0
value = (total 0)
offset1 = 32
offset2 = 32
data = (total 0)
header = Container:
length = 16
value = Container:
length = 32
unknown = 0
device_id = \x03\xb0\xd0v (total 4)
ts = 1970-01-01 04:40:22
offset1 = 0
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x03\xb0\xd0v\x00\x00A\xb6 (total 16)
checksum = \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (total 16)
2018-02-26 21:14:28 DEBUG (MainThread) [miio.device] Discovered 03b0d076 with ts: 1970-01-01 04:40:22, token: b’00000000000000000000000000000000’
2018-02-26 21:14:28 DEBUG (MainThread) [miio.device] 192.168.100.15:54321 >>: {‘id’: 1, ‘method’: ‘miIO.info’, ‘params’: }
2018-02-26 21:14:28 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’
2018-02-26 21:14:28 WARNING (MainThread) [homeassistant.components.light] Platform xiaomi_miio not ready yet. Retrying in 90 seconds.
2018-02-26 21:15:59 INFO (MainThread) [homeassistant.components.light.xiaomi_miio] Initializing with host 192.168.100.15 (token 4392b…)
2018-02-26 21:15:59 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’

I don’t know what miiO.info is, so I’ll look that up.

What type/model of light is it? Are you sure about the token? Did you block the internet access of the light?

OK, your question makes me second guess.
It’s a Xiaomi Philips Lightbulb. It worked before (somewhere in version 0.59.2, I forgot). However, I have factory reset it since. I also put it on a different WiFi and put it into the MiHome app. Which works.
I was unable to check the token, as the new MiHome app doesn’t save it in the database anymore. I just assumed it would retain the same token as before the Factory reset. No I doubt that.

OK, I will install an old APK of the MiHome app soon then on my tablet, so that I will try to extract the token.
Thanks for now.

1 Like

It was the token , which got reset after factory resetting and new WiFi. It WORKS ! Crying a bit now. So happy. Thanks @syssi

1 Like