@marcel_verpaalen
Sometimes my Desk Lamp doesn’t show the state, and I can’t change it from openHAB. However changing from the Mi Home app works (and it reports Wifi strength 40% so it is not that bad I think).
I get the following error:
2019-11-10 22:20:16.904 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Locating action for channel power: ON
2019-11-10 22:20:16.907 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Sending command set_power["on"]
2019-11-10 22:20:16.909 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":13252,"method":"set_power","params":["on"]} -> 10.0.0.99 (Device: 0443DBCD token: B0982F510BA3E30BD34F37EE6C046D71 Queue: 1)
2019-11-10 22:20:16.910 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.99)
2019-11-10 22:20:16.912 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.99) success
2019-11-10 22:20:16.913 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Periodic update for 'miio:generic:0443DBCD' (miio:basic)
2019-11-10 22:20:16.915 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.99)
2019-11-10 22:20:16.917 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.99) success
2019-11-10 22:20:16.919 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":13253,"method":"get_prop","params":["power","bright","delayoff","ct","color_mode"]} -> 10.0.0.99 (Device: 0443DBCD token: B0982F510BA3E30BD34F37EE6C046D71 Queue: 2)
2019-11-10 22:20:16.921 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.99)
2019-11-10 22:20:16.925 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.99) success
2019-11-10 22:20:16.927 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":13254,"method":"get_prop","params":["name"]} -> 10.0.0.99 (Device: 0443DBCD token: B0982F510BA3E30BD34F37EE6C046D71 Queue: 2)
2019-11-10 22:20:16.928 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.99)
2019-11-10 22:20:16.929 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Received message is invalid JSON:
2019-11-10 22:20:16.931 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0443DBCD type: SET_POWER, result: null, fullresponse: {"error":"Received message is invalid JSON"}
2019-11-10 22:20:16.932 [DEBUG] [internal.handler.MiIoAbstractHandler] - Error received: "Received message is invalid JSON"
2019-11-10 22:20:16.935 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0443DBCD type: GET_PROPERTY, result: ["ok"], fullresponse: {"result":["ok"],"id":13252}
2019-11-10 22:20:16.936 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Unexpected size different. Request size 5, response size 1. (Req: ["power","bright","delayoff","ct","color_mode"], Resp:["ok"])
2019-11-10 22:20:16.940 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.99) success
==> /var/log/openhab2/events.log <==
2019-11-10 22:20:16.941 [nt.ItemStatePredictedEvent] - miDeskLamp_Power predicted to become ON
2019-11-10 22:20:16.959 [vent.ItemStateChangedEvent] - miDeskLamp_Power changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2019-11-10 22:20:16.961 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Error while handing message {"result":["ok"],"id":13252}
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.rangeCheck(ArrayList.java:657) ~[?:?]
at java.util.ArrayList.get(ArrayList.java:433) ~[?:?]
at com.google.gson.JsonArray.get(JsonArray.java:194) ~[21:com.google.gson:2.8.2.v20180104-1110]
at org.openhab.binding.miio.internal.handler.MiIoBasicHandler.updateProperties(MiIoBasicHandler.java:396) ~[244:org.openhab.binding.miio:2.5.0.M4]
at org.openhab.binding.miio.internal.handler.MiIoBasicHandler.onMessageReceived(MiIoBasicHandler.java:450) [244:org.openhab.binding.miio:2.5.0.M4]
at org.openhab.binding.miio.internal.transport.MiIoAsyncCommunication$MessageSenderThread.run(MiIoAsyncCommunication.java:226) [244:org.openhab.binding.miio:2.5.0.M4]
2019-11-10 22:20:16.979 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Received message is invalid JSON:
==> /var/log/openhab2/events.log <==
2019-11-10 22:20:16.975 [vent.ItemStateChangedEvent] - miDeskLamp_Power changed from ON to OFF
==> /var/log/openhab2/openhab.log <==
2019-11-10 22:20:16.989 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0443DBCD type: GET_PROPERTY, result: null, fullresponse: {"error":"Received message is invalid JSON"}
2019-11-10 22:20:16.990 [DEBUG] [internal.handler.MiIoAbstractHandler] - Error received: "Received message is invalid JSON"
And restarting the bundle usually solves this issue so it doesn’t seem like a connection issue for me. I don’t know if anything changed since M3, but I saw this more frequently. Before that it was more realiable. And nothing changed in the network