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

STYJ02YM - AttributeError: 'ViomiVacuumStatus' object has no attribute 'mop_type' #704

Closed
Zaschii opened this issue May 24, 2020 · 9 comments · Fixed by #705
Closed

STYJ02YM - AttributeError: 'ViomiVacuumStatus' object has no attribute 'mop_type' #704

Zaschii opened this issue May 24, 2020 · 9 comments · Fixed by #705
Labels

Comments

@Zaschii
Copy link

Zaschii commented May 24, 2020

Hi all,
it seems that miiocli viomivacuum --ip 192.168.X.X --token XXXX info is working...

Model: viomi.vacuum.v7
Hardware version: Linux
Firmware version: 3.5.3_0047

But i get the following error with the status command....

miiocli viomivacuum --ip 192.168.X.X --token XXXX status

Traceback (most recent call last):
File "/usr/local/bin/miiocli", line 8, in
sys.exit(create_cli())
File "/usr/local/lib/python3.7/dist-packages/miio/cli.py", line 44, in create_cli
return cli(auto_envvar_prefix="MIIO")
File "/usr/local/lib/python3.7/dist-packages/miio/click_common.py", line 59, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/miio/click_common.py", line 285, in wrap
result_msg = result_msg_fmt.format(**kwargs)
AttributeError: 'ViomiVacuumStatus' object has no attribute 'box_type'

BR

@rytilahti
Copy link
Owner

This will we fixed in the next release (#695).

@Zaschii
Copy link
Author

Zaschii commented May 24, 2020

Thanks... but next thing is the mop_type :-(...

after boy_type it seems that mop_type is also wrong or missing...

Traceback (most recent call last):
File "/usr/local/bin/miiocli", line 8, in
sys.exit(create_cli())
File "/usr/local/lib/python3.7/dist-packages/miio/cli.py", line 44, in create_cli
return cli(auto_envvar_prefix="MIIO")
File "/usr/local/lib/python3.7/dist-packages/miio/click_common.py", line 59, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/miio/click_common.py", line 285, in wrap
result_msg = result_msg_fmt.format(**kwargs)
AttributeError: 'ViomiVacuumStatus' object has no attribute 'mop_type'

@rytilahti rytilahti reopened this May 24, 2020
@rytilahti
Copy link
Owner

Ah, thanks for testing! The mop_type variable is not exposed at all, so for testing you could remove this line here: https://github.com/rytilahti/python-miio/blob/master/miio/viomivacuum.py#L207

@rytilahti rytilahti added the bug label May 24, 2020
@rytilahti rytilahti changed the title STYJ02YM - AttributeError: 'ViomiVacuumStatus' object has no attribute 'box_type' STYJ02YM - AttributeError: 'ViomiVacuumStatus' object has no attribute 'mop_type' May 24, 2020
@Zaschii
Copy link
Author

Zaschii commented May 24, 2020

Thanks for your quick reply... next missing value is water_level ;-)

Traceback (most recent call last):
File "/usr/local/bin/miiocli", line 8, in
sys.exit(create_cli())
File "/usr/local/lib/python3.7/dist-packages/miio/cli.py", line 44, in create_cli
return cli(auto_envvar_prefix="MIIO")
File "/usr/local/lib/python3.7/dist-packages/miio/click_common.py", line 59, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/miio/click_common.py", line 285, in wrap
result_msg = result_msg_fmt.format(**kwargs)
AttributeError: 'ViomiVacuumStatus' object has no attribute 'water_level'

@Zaschii
Copy link
Author

Zaschii commented May 24, 2020

i removed water_level too and now status is working....

State: ViomiVacuumState.Docked
Mode: ViomiMode.Vacuum
Error: Unknown error None
Battery: 100
Fan speed: ViomiVacuumSpeed.Silent
Box type: ViomiBinType.Vacuum
Clean time: 0:00:00
Clean area: 1.1
Remember map: True
Has map: True
Has new map: False
Mop mode: ViomiMode.Vacuum

Thanks and BR

@Zaschii
Copy link
Author

Zaschii commented May 24, 2020

some other question... because iam too bad in python sorry :-).

How can i receive e.g. just the state from the viomistatus object.
As i can see the object is a zip with (properties, value).

e.g. the output of my small python script is just...
<miio.viomivacuum.ViomiVacuumStatus object at 0x7f38824fd668>

my python script

from miio import ViomiVacuum

vac = ViomiVacuum("192.168.X.X", "tokenXXXXXXX")

status_obj = vac.status()
print(status_obj)

@rytilahti
Copy link
Owner

Feel free to check out the PR (it should now display all information correctly, I hope).

To your question about accessing the state, all the elements in VacuumStatus class are properties, so you can do the following:

from miio import ViomiVacuum

vac = ViomiVacuum("192.168.X.X", "tokenXXXXXXX")

status_obj = vac.status()
print(status_obj.state)

@Zaschii
Copy link
Author

Zaschii commented May 24, 2020

thanks a lot... status output looks good...

State: ViomiVacuumState.Docked
Mode: ViomiMode.Vacuum
Error: Unknown error 2105
Battery: 100
Fan speed: ViomiVacuumSpeed.Silent
Box type: ViomiBinType.Vacuum
Mop type: 0
Clean time: 0:00:00
Clean area: 1.1
Water grade: ViomiWaterGrade.Medium
Remember map: True
Has map: True
Has new map: False
Mop mode: ViomiMode.Vacuum

@rytilahti
Copy link
Owner

Great, I think we can then merge it. Thanks for testing & reporting!

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

Successfully merging a pull request may close this issue.

2 participants