Roomba not able to send Raw commands

Hi there,

let me first state I am quite new to Home Assistant and Python in general, but I’m eager to learn. So please bear with me if I’m doing something stupid.

Running Home assistant 0.106.0 on Raspberry Pi 3B

I have succesfully integrated my Roomba 960 with the Roomba integration. Standard tasks as starting to clean my house when we are not at home are working nicely.
Now I want to extend my automation and I would like to try to send some raw commands to my Roomba.

If I understand correctly I should be able to send raw commands to my Roomby by using

vacuum.send_command

From the home assitant component i see:

async def async_send_command(self, command, params=None, **kwargs):
        """Send raw command."""
        _LOGGER.debug("async_send_command %s (%s), %s", command, params, kwargs)
        await self.hass.async_add_job(self.vacuum.send_command, command, params)
        return True

The code also includes:

async def async_turn_on(self, **kwargs):
        """Turn the vacuum on."""
        await self.hass.async_add_job(self.vacuum.send_command, "start")
        self._is_on = True

So I tried to send this start command via the raw command via services in developer tools with the following (as per given example, the example shown in Home Assistant is actually for a xiaomi vacuum):

vacuum.send_command
entity_id: vacuum.dusty_dave
command: "start"

Sadly this gives me an error for which I am probably to newby to understand. The following is in the logs:

send_command() takes 2 positional arguments but 3 were given
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1230, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1253, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 198, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 402, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 590, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 433, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/roomba/vacuum.py", line 262, in async_send_command
    await self.hass.async_add_job(self.vacuum.send_command, command, params)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
TypeError: send_command() takes 2 positional arguments but 3 were given

Can somebody point me in the right direction?
Thanks in advance.

Hello @freekode, I’m really sorry to bother. I saw you made huge adjustements to Roombapy for version 1.5.0 and do not know who else to turn too.
From how I see the readme from roombapy now, is it correct that it is not possible to send raw commands through roombapy?
I tried to go through the code myself, I think I need to dive into MQTT and Python a lot more because I was not able to understand all. Is correct that there is scaffolding for Raw commands but not fully implemented yet?
It would help a lot if I understand my problem is just because it is not possible (yet) or that I’m doing something completely wrong. In the mean time I will try to find more time to understand Python & MQTT more.

Hi,
Will check it out, hope today, I’m not exactly know what should be passed to send_command method.

can confirm, there is a bug with send_command,
it fixed here and soon will be merged.
also I version will be soon updated in HA code

1 Like

Thank you very much!
It was driving me crazy as I still couldn’t figure it out myself.
Going through the code learned me a lot though and with the commit you made I understand it better now as well.