lumi icon indicating copy to clipboard operation
lumi copied to clipboard

JSON result was not a dictionary

Open freefelt opened this issue 3 years ago • 1 comments

Приходят такие ворнинги. В описании ничего конкретного нет, но я методом тыка проверил. Если выключить lumi, то они пропадают, если включить, то тут же появляются снова.

freefelt avatar Jul 28 '21 06:07 freefelt

Я тоже получаю большое количество варнингов. I get a lot of warnings too

Logger: homeassistant.components.mqtt.mixins
Source: components/mqtt/mixins.py:240
Integration: MQTT (documentation, issues)
First occurred: 18 октября 2021 г., 22:08:58 (846 occurrences)
Last logged: 09:19:43

JSON result was not a dictionary

После включения логгирования выяснилось, что проблема связана с кнопкой шлюза - Home Assistant получает значение числа вместо ожидаемого. Кусок лога с этой проблемой: After enabling logging, it turned out that the problem is related to the gateway button - Home Assistant receives the value of the number instead of the expected one. A piece of the log with this problem:

2021-10-31 12:30:22 DEBUG (Thread-5) [paho.mqtt.client] Received PUBLISH (d0, q0, r0, m0), 'lumi/light', ...  (15 bytes)
2021-10-31 12:30:22 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on lumi/light: b'{"state":"OFF"}'
2021-10-31 12:30:22 DEBUG (Thread-5) [paho.mqtt.client] Received PUBLISH (d0, q0, r0, m0), 'lumi/button/action', ...  (1 bytes)
2021-10-31 12:30:22 DEBUG (Thread-5) [paho.mqtt.client] Received PUBLISH (d0, q0, r0, m0), 'lumi/button/action', ...  (1 bytes)
2021-10-31 12:30:22 DEBUG (Thread-5) [paho.mqtt.client] Received PUBLISH (d0, q0, r0, m0), 'homeassistant/light/lumi_light/config', ...  (272 bytes)
2021-10-31 12:30:22 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on lumi/button/action: b'0'
2021-10-31 12:30:22 WARNING (MainThread) [homeassistant.components.mqtt.mixins] JSON result was not a dictionary
2021-10-31 12:30:22 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on lumi/button/action: b'0'
2021-10-31 12:30:22 WARNING (MainThread) [homeassistant.components.mqtt.mixins] JSON result was not a dictionary
2021-10-31 12:30:22 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/light/lumi_light/config: b'{"name":"Lumi Light","uniq_id":"lumi_light","schema":"json","rgb":true,"brightness":true,"stat_t":"lumi/light","cmd_t":"lumi/light/set","device":{"identifiers":["xiaomi_gateway"],"name":"Xiaomi_Gateway","sw_version":"1.0","model":"Xiaomi Gateway","manufacturer":"Xiaomi"}}'
2021-10-31 12:30:22 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'Lumi Light', 'unique_id': 'lumi_light', 'schema': 'json', 'rgb': True, 'brightness': True, 'state_topic': 'lumi/light', 'command_topic': 'lumi/light/set', 'device': {'identifiers': ['xiaomi_gateway'], 'name': 'Xiaomi_Gateway', 'sw_version': '1.0', 'model': 'Xiaomi Gateway', 'manufacturer': 'Xiaomi'}, 'platform': 'mqtt'}
2021-10-31 12:30:22 INFO (MainThread) [homeassistant.components.mqtt.discovery]

Тут видно, что b'0 'не является сообщением JSON, что и вызывает появление ошибки. Here you can see that b'0 'is not a JSON message, which causes the error to appear.

Сейчас, т.к. кнопка не используется, отключил объект кнопки в Home assistant и на данный момент предупреждения больше не появлялось. Now, since the button is not used, I disabled the button object in the Home assistant and at this point the warning no longer appears.

Anton-Ka avatar Oct 31 '21 15:10 Anton-Ka