Whytey / moebot-hass-integration

A HomeAssistant integration for MoeBot (and compatible) TUYA mowers.
8 stars 0 forks source link

Error calling vacuum commands #1

Closed Ethan-G closed 1 year ago

Ethan-G commented 1 year ago

Hi. I've set up the integration, battery/state sensor seems to be working and mow time control works. However I can't issue any vacuum commands - start, stop, return etc all result in the below error.

Edit: oh I see, the other repo states that control isn't working yet. That's not clear from this repo, which implies control works with "Presents a Vacuum component for control of your MoeBot"


  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1808, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1845, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 961, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 726, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/vacuum/__init__.py", line 423, in async_start
    await self.hass.async_add_executor_job(self.start)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/moebot/vacuum.py", line 95, in start
    raise NotImplementedError()
NotImplementedError
Whytey commented 1 year ago

Hi @Ethan-G ,

First, wow, someone else is using this - that is cool!!! :)

Yeah, I never implemented control, though I keep thinking to myself that I should. Maybe you've just inspired me and I will crack on with it...

Can I confirm, are you using a model of MoeBot or some other branded version? Which brand, model?

Note: I have found that continual polling of the MoeBot would cause it to become unstable after a couple of weeks and you will find it has turned itself off - I have some thoughts on how to work around it, though they are mostly guesses since I can't see any output from MoeBot itself. Let me know if you see this instability.

Ethan-G commented 1 year ago

Yeah I've got a Moebot S10. Frustrating how there's no good existing integration hey. Thanks for the heads up about the instability, I might turn off the integration for now as there's little point for me without control.

If I ever get motivation I could possibly also have a crack at it and open a PR. If I ever do, I'll message you to ensure we're both not doing it. :)

Whytey commented 1 year ago

Hi @Ethan-G, control has now been added.

It seems to work reliably except the MoeBot has a pretty strict state machine and there is no easy way to reflect that in the Vacuum card. When in standby, you can start the mower (play button). When it is mowing, you can only pause mowing (pause button). From pause you can restart (play button) or cancel (stop button). You can only press the home button after cancelling the mower.

I will try and update the docs in the near future but for now feel free to give this a go.

Ethan-G commented 1 year ago

@Whytey Nice one! I'll have a play around. Yeah I'd noticed the strict state flow stuff even just with the Tuya app.

Could you not just call the right sequence of commands to get around that? For example return_to_base could call pause then cancel then dock. Depending on what happens when you call an invalid command, it might need to conditionally do those based on status, or do a try/catch.