openhab-addons icon indicating copy to clipboard operation
openhab-addons copied to clipboard

[miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken

Open mak-42 opened this issue 2 years ago • 3 comments

[miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken #13258

  1. Custom refresh command for "battery" was defined . The device with "4.1.8_9999" firmware version does not allowed to obtain this information by this way which prevents to obtain other values. The solution should work for both old firmware (the battery information would be requested as before) and it does not prevent the device with new firmware from sending other values (I checked it).

fix #13258

mak-42 avatar Aug 14 '22 18:08 mak-42

I don't really understand how this is fixing the problem. The command send to the device should be the same. Can you try lowering the maxPropertiesinstead, e.g. to 3 to see if the amount of properties has impact. If that does not work, can you try with maxProperties 1 which I think should also work. (in that case however your PR may be a better solution though)

marcelrv avatar Aug 14 '22 22:08 marcelrv

I described the problem in the correspondent issue. The device with firmware "4.1.8_9999" stops recognizing parameter "battery" in "get_value" command and returns "result":"ok" in the response instead of values if the parameter exists. I split the request for values into two requests: the first one for all the parameters ("pm25","co2","tvoc","humidity","temperature") except "battery" and another one for "battery" parameter. It allows to obtain all values except "battery" from the device with firmware "4.1.8_9999" and obtain all the values from the device with old firmware versions.

mak-42 avatar Aug 15 '22 06:08 mak-42

Yes, I understood your description. But there can be 2 causes of the issue:

  1. the battery is not recognized anymore in the new FW
  2. the amount of properties that can be requested in 1 request has changed in the new FW.

I would like to ensure the 2nd option is not the cause as in that case the lowering of maxProperties would do the trick as well in a better way.

marcelrv avatar Aug 15 '22 07:08 marcelrv

The device does not recognized request for battery value any more. I sent get_value["battery"] to device and received {"id":11974,"result":"ok","exe_time":32} from it. After that I sent get_value["temperature"] to device and received {"id":11987,"result":{"temperature":25.2},"exe_time":32} from it. Then I sent get_value["battery","temperature"] to the device and received {"id":12010,"result":"ok","exe_time":31} from it. At the end I sent get_value["somethingwrong","temperature"] to the device and received {"id":12026,"result":{"temperature":25.3},"exe_time":33} from it. I think it fully confirms my theory.

mak-42 avatar Aug 16 '22 19:08 mak-42

Agree. Please add a "readmeComment": "some smart remark about only supported for firmware version below xx" in the json So the readme will clarify this particular behaviour

marcelrv avatar Aug 16 '22 20:08 marcelrv

I'm totally agree with you. It might look like a riddle without the comment.

mak-42 avatar Aug 18 '22 21:08 mak-42

Done

mak-42 avatar Aug 19 '22 20:08 mak-42

@marcelrv may i ask you to merge this pull request?

nma-ro avatar Aug 31 '22 04:08 nma-ro

@ivo-pupkin I don't have rights to merge commits. maybe @fwolter can merge these or propose someone

marcelrv avatar Aug 31 '22 07:08 marcelrv

@mak-42 Does it mean that "battery_level" cannot be acquired anymore? Strange that an official Mi Home mobile app still gets this data from a device.

ildar170975 avatar Dec 17 '23 23:12 ildar170975

Strange that an official Mi Home mobile app still gets this data from a device.

The old way of getting this information locally was broken. I think the device still transfer battery level data to MI Home servers. It may be another way to obtain the battery level of the device, but someone should try to dig it up.

mak-42 avatar Dec 18 '23 04:12 mak-42

Thanks a lot for the reply. Do you know any way to "sniffer" a traffic between a device & server? With a possible decryption )))

ildar170975 avatar Dec 18 '23 07:12 ildar170975