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

I can't run set-voice command dreame.vacuum.p2041o #1946

Open
sverdlyuk opened this issue Jul 2, 2024 · 6 comments
Open

I can't run set-voice command dreame.vacuum.p2041o #1946

sverdlyuk opened this issue Jul 2, 2024 · 6 comments
Labels

Comments

@sverdlyuk
Copy link

Describe the bug
My device Xiaomi Vacuum MOP 2 Pro+ (dreame.vacuum.p2041o) is in the list of supported devices, but when running the command miiocli dreamevacuum --ip --token set_voice https://github.com/Findus23/voice_pack_dreame /raw/main/voice_pack.tar.gz 8ebfabb9e23e169a5c9b867266f9d1ef 4325024 I get the error Error: Unable to find set_voice in the mapping

Version information (please complete the following information):

  • OS: Linux Mint 21.3
  • python-miio: version 0.5.12

Device information:
If the issue is specific to a device [Use miiocli device --ip <ip address> --token <token> info]:

  • Model: dreame.vacuum.p2041o
  • Hardware version: Linux
  • Firmware version: 4.3.3_1111

To Reproduce
Steps to reproduce the behavior:

  1. miiocli dreamevacuum --ip 192.168.0.101 --token xxxxxxxxxxxx set_voice https://github.com/Findus23/voice_pack_dreame/raw/main/voice_pack.tar.gz 8ebfabb9e23e169a5c9b867266f9d1ef 4325024

Expected behavior
A clear and concise description of what you expected to happen.
I am waiting for the voice package to be installed

Console output
miiocli dreamevacuum --ip 192.168.0.101 --token xxxxxxxxxxxxxxxxxx set_voice https://github.com/Findus23/voice_pack_dreame/raw/main/voice_pack.tar.gz 8ebfabb9e23e169a5c9b867266f9d1ef 4325024
Running command set_voice
Error: Unable to find set_voice in the mapping

@sverdlyuk sverdlyuk added the bug label Jul 2, 2024
@rytilahti
Copy link
Owner

rytilahti commented Jul 2, 2024

This device does not use the same format as what's implemented in the class. If you try miiocli genericmiot --ip 127.0.0.1 --token 00000000000000000000000000000000 settings on your device, you'll see that there's audio:set-voice but it expects only a string parameter. I don't see anything hinting towards uploading/downloading new sound packs, so perhaps this device does only support changing between the existing packs?

@sverdlyuk
Copy link
Author

sverdlyuk commented Jul 3, 2024

This device does not use the same format as what's implemented in the class. If you try miiocli genericmiot --ip 127.0.0.1 --token 00000000000000000000000000000000 settings on your device, you'll see that there's audio:set-voice but it expects only a string parameter. I don't see anything hinting towards uploading/downloading new sound packs, so perhaps this device does only support changing between the existing packs?

Thank you for the quick response. I managed to load a custom voice package onto this vacuum cleaner using the Home Assistant - Vacuum Dreame integration. I see that the miio spec for the vacuum cleaner includes a command to load an audio package (SIID 7 audio, and properties PIID 4 set-voice). However, I want to load the voice package using python-miio. Can I load the package using the call command or a raw command?

@sverdlyuk
Copy link
Author

sverdlyuk commented Jul 11, 2024

This device does not use the same format as what's implemented in the class. If you try miiocli genericmiot --ip 127.0.0.1 --token 00000000000000000000000000000000 settings on your device, you'll see that there's audio:set-voice but it expects only a string parameter. I don't see anything hinting towards uploading/downloading new sound packs, so perhaps this device does only support changing between the existing packs?

I managed to load the voice package onto the vacuum cleaner using the Home Assistant Xiaomi Miot integration. It turned out that my vacuum cleaner accepts properties, not actions. Is it possible to use set_property with python-miio?

service: xiaomi_miot.set_miot_property
data:
  entity_id: vacuum.dreame_p2041o_796c_robot_cleaner
  siid: 7 # siid for audio
  piid: 4 # piid 
  value: '{"id":"UK","url":"https://github.com/oleksandr-belei/dreame-vacuum-uk-voice-packs/raw/main/voice_packs/uk_female_pensive","md5":"55cfr4272se1e77d9byhfebf9iv99730","size":3585448}'

Also, please clarify if the set_voice command executes miot.call_action?

@rytilahti
Copy link
Owner

rytilahti commented Jul 11, 2024

Glad you found a way to do what you wanted!

To answer your question, you can also set properties by using the miiocli tool. You should be able to use the raw siid-piid combination using miiocli genericmiot --ip <ip address> --token <token> set_property_by 7 4 'value' or using miiocli genericmiot set <name of the setting> '<value>' after obtaining the setting name using miiocli genericmiot --ip <ip address> --token <token> settings on the device.

It would be great to have the payload format documented somewhere for such custom commands in the documentation, but there is currently no pages for such. If you want to improve the documentation, perhaps https://python-miio.readthedocs.io/en/latest/device_docs/index.html would be the place to add a new "Dreame vacuum" page to do that.

@sverdlyuk
Copy link
Author

sverdlyuk commented Jul 13, 2024

Glad you found a way to do what you wanted!

To answer your question, you can also set properties by using the miiocli tool. You should be able to use the raw siid-piid combination using miiocli genericmiot --ip <ip address> --token <token> set_property_by 7 4 'value' or using miiocli genericmiot set <name of the setting> '<value>' after obtaining the setting name using miiocli genericmiot --ip <ip address> --token <token> settings on the device.

It would be great to have the payload format documented somewhere for such custom commands in the documentation, but there is currently no pages for such. If you want to improve the documentation, perhaps https://python-miio.readthedocs.io/en/latest/device_docs/index.html would be the place to add a new "Dreame vacuum" page to do that.

For me, the command worked

python -m miio.cli genericmiot --ip 192.168.50.157 --token 8ebfabb9e23e169a5c9b867266f9d1ef raw_command set_properties "[{'did': '1125390789', 'siid': 7, 'piid': 4, 'value' : '{\"id\":\"UK\",\"url\":\"https://github.com/oleksandr-belei/dreame-vacuum-uk-voice-packs/raw/main/voice_packs/uk_female_pensive\",\"md5\":\"55bfe4272ce1e77d9bbafebf9ec99330\",\"size\":3585448}'}]" 
Running the command raw_command
[{'siid': 7, 'did': '1023390559', 'piid': 4, 'code': 0}]

However, I want to test the execution of the set_property_by command. But the command:

python -m miio.cli genericmiot --ip 192.168.50.157 --token 8ebfabb9e23e169a5c9b867266f9d1ef set_property_by 7 4 '{"id":"UK","url":"https://github.com/Findus23/voice_pack_dreame/raw/main/voice_pack.tar.gz","md5":"8ebfabb9e23e169a5c9b867266f9d1ef","size":4325024}'
Running command set_property_by
[{'siid': 7, 'did': 'set-7-4', 'piid': 4, 'code': -1}]

gives an error [{'siid': 7, 'did': 'set-7-4', 'piid': 4, 'code': -1}] Judging by the error, I think I need to specify the device id (did), but I don't know how to do it.

@rytilahti
Copy link
Owner

You can specify --name to set_property_by, then it will be used as the did in the request payload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants