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

Vacuum timezone returns 'int' object is not subscriptable #921

Closed
faaafo opened this issue Jan 30, 2021 · 8 comments · Fixed by #932 or #949
Closed

Vacuum timezone returns 'int' object is not subscriptable #921

faaafo opened this issue Jan 30, 2021 · 8 comments · Fixed by #932 or #949
Labels

Comments

@faaafo
Copy link

faaafo commented Jan 30, 2021

I can confirm everything was running fine once and I'm still able to run certain mirobo commands like e.g. start stop home etc.

Yet the vacuum doesnt communicate anymore with homeassistant nor do certain commands like the one below work:

bash-5.0# mirobo --ip 192... --token 664... -d timezone

returns

INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Read stored sequence ids: {'seq': 41, 'manual_seq': 0}
DEBUG:miio.vacuum_cli:Connecting to 192... with token 664...
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container: 
    data = Container: 
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = b'!1\x00 \x00\x00\x00\x00\x03L\x83x\x00\x00\xfb5' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('034c8378')
            ts = 1970-01-01 17:51:49
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
DEBUG:miio.miioprotocol:Discovered 034c8378 with ts: 1970-01-01 17:51:49, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192...:54321 >>: {'id': 42, 'method': 'get_timezone', 'params': []}
DEBUG:miio.miioprotocol:192...:54321 (ts: 1970-01-01 17:51:50, id: 42) << {'result': 0, 'id': 42}
Traceback (most recent call last):
  File "/usr/local/bin/mirobo", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/site-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/miio/vacuum_cli.py", line 544, in timezone
    click.echo("Timezone: %s" % vac.timezone())
  File "/usr/local/lib/python3.8/site-packages/miio/vacuum.py", line 576, in timezone
    res = self.send("get_timezone")[0]
TypeError: 'int' object is not subscriptable

Environment

Linux 5.4.79-v7+
mirobo, version 0.5.4 on Docker 20.10.1 (community edition)
@rytilahti rytilahti added the bug label Feb 2, 2021
@rytilahti
Copy link
Owner

Could you please post the miiocli info output (or at least the model number & the fw version), as this may be something that only happens on specific hardware/firmware combinations.

@faaafo
Copy link
Author

faaafo commented Feb 3, 2021 via email

@rytilahti
Copy link
Owner

@faaafo could you please test the attached PR (with commands timezone and timers)?

@faaafo
Copy link
Author

faaafo commented Feb 7, 2021 via email

@rytilahti
Copy link
Owner

The former, the latter is just the homeassistant shim that uses this library for controlling the device.

@faaafo
Copy link
Author

faaafo commented Feb 13, 2021

@faaafo could you please test the attached PR (with commands timezone and timers)?

No changes after applying your PR to /usr/local/lib/python3.8/site-packages/miio/vacuum.py and rebooting the machine.

timezone command still returns int' object is not subscriptable

@rytilahti
Copy link
Owner

Ah, sorry, I misread the response from the device (returning a bare integer). Could you please check the new PR?

@faaafo
Copy link
Author

faaafo commented Feb 15, 2021

❤️ 🚀 Works 🙏 Thank you so much

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