python-miio
python-miio copied to clipboard
Fetching non-readables still return a success but no value (dreame.vacuum.mc1808)
Describe the bug Trying to get status of the device with miiocli it generates a runtime error bug report
Version information (please complete the following information):
- OS: Windows & Linux
- python-miio: miiocli, version 0.5.11
Device information:
If the issue is specific to a device [Use miiocli device --ip <ip address> --token <token> info
]:
Model: dreame.vacuum.mc1808
Hardware version: Linux
Firmware version: 4.3.3_1122
To Reproduce
Steps to reproduce the behavior:
1.
run command miiocli dreamevacuum --ip 192.168.1.217 --token xxxxxxxxxxxxxxxxxxxxxxxxxxx status
, generates error bellow:
File "...\lib\site-packages\miio\integrations\vacuum\dreame\dreamevacuum_miot.py", line 447, in status
for prop in self.get_properties_for_mapping(max_properties=10)
File "...\lib\site-packages\miio\integrations\vacuum\dreame\dreamevacuum_miot.py", line 447, in
Expected behavior Status of device to be shown like this: Battery level: 100 Brush life level: 75 Brush left time: 225 Charging state: Charging2 Cleaning mode: Default Device fault: NoFaults Device status: Idle Filter left level: 75 Filter life level: 50....
Console output
If applicable, add console output to help explain your problem.
If the issue is about communication with a specific device, consider including the output using the --debug
flag.
Proposed solution
this have worked for me to solve the error.
replace line:
prop["did"]: prop["value"] if prop["code"] == 0 else None
with line:
prop["did"]: prop.get("value", "empty")
@rytilahti I have the same problem and can confirm that this fix works. Is it valid fix? Can we actually implement it?
Could you please use --debug
and show how the response payload looks like?
Thanks! Looks like {'siid': 18, 'did': 'first_clean_time', 'piid': 12, 'code': 0},
is the culprit, I'll look into getting it fixed soon.
Sorry for the delay, life happened. The linked PR should fix this for good, could you please give it a try? If you also have some other miot devices, it would be great if you could confirm that they keep working as expected, thanks!
Still the same. 0.5.12.
There has been no new release with the fix, so you need to install the git master to test this.
Sure, I've tried already, still the same.
>> pip install git+https://github.com/rytilahti/python-miio
>> miiocli dreamevacuum --ip XXX --token XXX status
...
prop["did"]: prop["value"] if prop["code"] == 0 else None
KeyError: 'value'
Uhh, that's odd but without seeing more information it is hard to know what is the cause. My initial assumption was that the original issue was due to non-readable (actions, write-only properties) were part of the request, and the firmware did not handle the error reporting properly.
Cleaning up get_properties
and get_properties_for_mapping
has been a long due, so I opened this to keep track on that. The methods to be used by integration should rather return pre-filtered dictionaries that can be directly passed to the status containers.
@Lixander78 Thanks for the workaround, works like a charm here 👍
@rytilahti
This is also an issue for my vacuum... The first_clean_time
prop does not have a value. It is also not filtered out by this PR.
Please can we get an update here.