Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[miio] Fix Qingping Air Monitor (cgllc.airmonitor.s1) support #13262

Merged
merged 2 commits into from Sep 18, 2022

Conversation

mak-42
Copy link
Contributor

@mak-42 mak-42 commented Aug 14, 2022

[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

…penhab#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).

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>
@mak-42 mak-42 force-pushed the cgllc.airmonitor.s1.battery branch from f1d081e to 2e1ffd3 Compare August 14, 2022 19:05
@mak-42 mak-42 marked this pull request as ready for review August 14, 2022 19:18
@mak-42 mak-42 requested a review from marcelrv as a code owner August 14, 2022 19:18
@marcelrv
Copy link
Contributor

marcelrv commented Aug 14, 2022

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)

@mak-42
Copy link
Contributor Author

mak-42 commented Aug 15, 2022

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.

@marcelrv
Copy link
Contributor

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.

@mak-42
Copy link
Contributor Author

mak-42 commented Aug 16, 2022

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.

@marcelrv
Copy link
Contributor

marcelrv commented Aug 16, 2022

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

…penhab#13258

1.  The comment clarifying the "battery" parameter behavior was added.

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>
@mak-42
Copy link
Contributor Author

mak-42 commented Aug 18, 2022

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

@mak-42
Copy link
Contributor Author

mak-42 commented Aug 19, 2022

Done

@nma-ro
Copy link

nma-ro commented Aug 31, 2022

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

@marcelrv marcelrv requested a review from fwolter August 31, 2022 07:04
@marcelrv
Copy link
Contributor

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

@fwolter fwolter merged commit b6a2240 into openhab:main Sep 18, 2022
@fwolter fwolter changed the title [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken [miio] Fix Qingping Air Monitor (cgllc.airmonitor.s1) support Sep 18, 2022
@fwolter fwolter added this to the 3.4 milestone Sep 18, 2022
@lolodomo lolodomo added the bug An unexpected problem or unintended behavior of an add-on label Sep 18, 2022
leifbladt pushed a commit to leifbladt/openhab-addons that referenced this pull request Oct 15, 2022
…penhab#13262)

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#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).

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#13258
1.  The comment clarifying the "battery" parameter behavior was added.

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>
seime pushed a commit to seime/openhab2-addons that referenced this pull request Oct 16, 2022
…penhab#13262)

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#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).

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#13258
1.  The comment clarifying the "battery" parameter behavior was added.

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>
andan67 pushed a commit to andan67/openhab-addons that referenced this pull request Nov 6, 2022
…penhab#13262)

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#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).

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#13258
1.  The comment clarifying the "battery" parameter behavior was added.

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Nov 12, 2022
…penhab#13262)

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#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).

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#13258
1.  The comment clarifying the "battery" parameter behavior was added.

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
psmedley pushed a commit to psmedley/openhab-addons that referenced this pull request Feb 23, 2023
…penhab#13262)

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#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).

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#13258
1.  The comment clarifying the "battery" parameter behavior was added.

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this pull request Feb 28, 2023
…penhab#13262)

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#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).

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

* [miio] Qingping Air Monitor (cgllc.airmonitor.s1) support is broken openhab#13258
1.  The comment clarifying the "battery" parameter behavior was added.

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>

Signed-off-by: Dmitry Malenok <_mak_@bk.ru>
@ildar170975
Copy link

@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.

@mak-42
Copy link
Contributor Author

mak-42 commented Dec 18, 2023

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.

@ildar170975
Copy link

ildar170975 commented Dec 18, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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