Trigger viomi map upload before downloading the map#745
Open
swingerman wants to merge 1 commit into
Open
Conversation
Viomi vacuums do not keep a map in the cloud. They upload the current map only when sent the set_uploadmap miio command, and the uploaded map is stored as cloud object "1" (not "0"). ViomiCloudVacuum therefore always failed to download a map with "Object Not Found". ViomiCloudVacuum now overrides get_map_name() to send set_uploadmap through the existing cloud miio relay (get_other_info -> /v2/home/rpc/<device_id>) before returning map name "1". This keeps the viomi platform pure-cloud, with no local connection added. On a failed upload it returns None so the caller raises FailedMapDownloadException and retries. Also widens get_other_info's parameters annotation to dict | list: legacy miio commands such as set_uploadmap take positional list params. Verified end-to-end against a live viomi.vacuum.v8.
d152ed1 to
1008cb8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Viomi vacuums never produce a map.
ViomiCloudVacuuminheritsget_map_name()from
BaseXiaomiCloudVacuum, which returns"0", so the download requests cloudobject
<user_id>/<device_id>/0. For viomi devices that object does not exist —every download fails (
FailedMapDownloadException; FDS returnsObject Not Found).Root cause: unlike roborock, viomi vacuums do not keep a map in the cloud. They
upload the current map to Xiaomi FDS storage only when explicitly told to, via the
set_uploadmapmiio command, and the uploaded map is stored as object1— not0. The Mi Home app sendsset_uploadmapwhenever its map view is opened; theintegration never does.
Fix
ViomiCloudVacuumnow overridesget_map_name()to:set_uploadmapto the vacuum through the existing cloud miio relay —XiaomiCloudConnector.get_other_info()→/v2/home/rpc/<device_id>— so theviomi platform stays pure-cloud (no local miio connection added);
"1".If the upload request is not acknowledged it returns
None, so the caller raisesFailedMapDownloadExceptionand retries on the next cycle (rather than masking thefailure) — consistent with the other vacuum implementations.
This also widens
get_other_info()'sparametersannotation fromdicttodict | list: legacy miio commands such asset_uploadmaptake positional listparams, whereas the existing dreame caller passes a dict.
Testing
Verified end-to-end against a live
viomi.vacuum.v8("Mi Robot Vacuum-Mop P", EUserver):
get_other_info(device_id, "set_uploadmap", [1])→{"code":0,"message":"ok","result":["ok"]}1contains the map; object0stays absentViomiCloudVacuum.get_map()then downloads (~8 KB zlib) and parses itinto an 800×800, 5-room map
Before this change the same vacuum produced no map on v3 (or on v2.2.x).
Notes
1) and theset_uploadmapparameter ([1]) were determinedempirically on
viomi.vacuum.v8;set_uploadmap [0]did not populate slot0on the test unit. Other viomi models would benefit from validation.
should_update_map(alwaysTrue),so the upload is requested every coordinator cycle even when the vacuum is idle.
An override that checks vacuum state (as roborock does) could avoid that.