-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
fix json decode quirk for xiaomi e10 #1922
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1922 +/- ##
==========================================
+ Coverage 81.41% 81.45% +0.03%
==========================================
Files 193 196 +3
Lines 18636 18891 +255
Branches 4045 4111 +66
==========================================
+ Hits 15173 15387 +214
- Misses 3180 3211 +31
- Partials 283 293 +10 ☔ View full report in Codecov by Sentry. |
Is the command still working, but just returning invalid json? Otherwise looks fine for me, thanks for the PR! |
@rytilahti this is an interesting story. e10 is a cheap model that don't support maps. However, it still has the maps commands, just in a way no one can access them: there is only one map called "hello" with index 0, and according to the spec, map indexes start from one. So this corrupted json is the robot confused and returning empty result. (probably something like |
Heh, yeah, some firmware behave weirdly on error states, likely for the reason you mention. Would you mind adding a unit test similar as https://github.com/rytilahti/python-miio/blob/master/miio/tests/test_protocol.py#L129 for this quirk? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @matan-h! I added a quick test and will merge this after the CI passes.
Version:
Firmware version:
2.2.4_0050
Hardware version:
esp32
some commands (e.g.
genericmiot call map:rename-map '[0,"string"]'
) generate json-like string like this:and this produce the error:
I fix that by removing the nonsense
result":,
.