Skip to content

Cannot (really) control Roomba 980 #128

@Rafsisa

Description

@Rafsisa

Hi!

I'm working with the current script:

import asyncio
from roomba import Roomba

async def test():
        await roomba.connect()
        roomba.send_command('start')
        await asyncio.sleep(5)
        roomba.send_command('stop')
        roomba.send_command('dock')
        await roomba.disconnect()

roomba = Roomba('172.17.23.104')
loop = asyncio.get_event_loop()
loop.run_until_complete(test())

This indeed starts the Roomba 980 at 172.17.23.104, but that's the last thing that works. The vacuum never stops or docks as it should. The output of this script is as follows:

Pending event queue size is: 1
Pending event queue size is: 1
/home/user/src/Roomba980-Python/roomba/roomba.py:607: RuntimeWarning: coroutine 'Roomba._disconnect' was never awaited
  self.loop.create_task(self._disconnect())
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task exception was never retrieved
future: <Task finished name='Task-26' coro=<Roomba._disconnect() done, defined at /home/user/src/Roomba980-Python/roomba/roomba.py:609> exception=AttributeError("type object '_asyncio.Task' has no attribute 'all_tasks'")>
Traceback (most recent call last):
  File "/home/user/src/Roomba980-Python/roomba/roomba.py", line 612, in _disconnect
    tasks = [t for t in asyncio.Task.all_tasks() if t is not asyncio.Task.current_task()]
                        ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object '_asyncio.Task' has no attribute 'all_tasks'
Traceback (most recent call last):
  File "/home/user/src/Roomba980-Python/roomba/./test.py", line 16, in <module>
    loop.run_until_complete(test())
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/user/src/Roomba980-Python/roomba/./test.py", line 12, in test
    await roomba.disconnect()
TypeError: object NoneType can't be used in 'await' expression

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions