Weback cloud integration: testers and help required

Hello everyone!
I recently inherited an X600pro and i’m also trying to interface it to my hassio instance.

@Jezza34000, may I ask you in wich part of the code do you initialize the API to connect to Weback?
Unfortunately I’m not very familiar with either Jeedom nor French :sweat_smile:

1 Like

Hello
About my code it’s not that easy to “convert” for HomeAssitant cause my Jeedom’s plugin use mainly PHP code for Authentication, Commands, Information ( you can find this part in this file : weback/weback.class.php at 84092204c7e9d48b6b079f034e3f86b2c0fce8b1 · Jezza34000/weback · GitHub)
and Python for Weback server’s communication. ( here : weback/webackd.py at 84092204c7e9d48b6b079f034e3f86b2c0fce8b1 · Jezza34000/weback · GitHub )
Main difficulty is Weback dosen’t use anymore HTTP and AWS communication (old HA plugin) to control robot.
HTTP is only used to get credentials information and then use WSS to control it.
If some one who want to completly rewrite old plugin : https://github.com/opravdin/weback-hass
I could help for new protocole…

Well, I’d like to at least try to recreate the plugin under your recommendations, so that I can take full advantage of my vacuum cleaner, because, let’s face it, the app isn’t really good.
The problem is that until mid-September I will have to take university exams, and so I will be available, let’s say from October.
I hope you will be still willing to help for that time :crossed_fingers:

Yes i follow this post send me a message when you need information :+1:

Hello guys, I’ve just uploaded my custom component to github. I’m using it to control my weback robot (it’s an ABIR XS-X6 robot). It’s the only and first custom component I’ve made so far. To create it I checked other github repos looking for information/etc. also decompiled the APK file, patched it to accept my custom certificate and did a man in the middle attack using an ubuntu server acting as a hotspot and proxy using with mitmproxy in order to see the encrypted TLS and WSS traffic between the weback app and their servers in China. Feel free to contribute, suggest,etc. And please, let me know if you are able to use it with other robot brands so I can create some list with the tested models:

2 Likes

Excellent :slight_smile:
Good job

Hello agustin-e, and thank you for your work !

Unfortunately, it is not working by me, as I get “Error during setup of component weback_robot_vacuum” after restart.

Any idea why ?

More details :

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 218, in connect_tcp
    await event.wait()
  File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1842, in wait
    if await self._event.wait():
  File "/usr/local/lib/python3.9/asyncio/locks.py", line 226, in wait
    await fut
asyncio.exceptions.CancelledError

Hi Nathan, maybe it’s showing something more in your log? Some call from my component? Maybe some previous error? The component connects via websockets to the weback servers (after the initial login via HTTPS).

Hi thank you for answering so fast. Also i’m more an hardware than a software guy, I put the complete log, so if you see something…

Always happy to learn :slight_smile:

Log Details (ERROR)
This error originated from a custom integration.
Logger: homeassistant.setup
Source: custom_components/weback_robot_vacuum/WebackVacuumApi.py:64
Integration: weback_robot_vacuum
First occurred: 11:57:16 AM (1 occurrences)
Last logged: 11:57:16 AM

Error during setup of component weback_robot_vacuum
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 218, in connect_tcp
    await event.wait()
  File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1842, in wait
    if await self._event.wait():
  File "/usr/local/lib/python3.9/asyncio/locks.py", line 226, in wait
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 218, in connect_tcp
    await event.wait()
  File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 658, in __aexit__
    raise CancelledError
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 8, in map_exceptions
    yield
  File "/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/usr/local/lib/python3.9/site-packages/anyio/_core/_tasks.py", line 118, in __exit__
    raise TimeoutError
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 86, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 63, in handle_async_request
    stream = await self._connect(request)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 111, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/httpcore/backends/auto.py", line 29, in connect_tcp
    return await self._backend.connect_tcp(
  File "/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py", line 109, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc)
httpcore.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 235, in _async_setup_component
    result = await task
  File "/config/custom_components/weback_robot_vacuum/__init__.py", line 50, in async_setup
    await weback_api.login()
  File "/config/custom_components/weback_robot_vacuum/WebackVacuumApi.py", line 64, in login
    r = await client.post(AUTH_URL, json=data)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1842, in post
    return await self.request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1527, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1614, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1642, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1679, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1716, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectTimeout

Hi Nathan, seems like a time out, strange. Can you try modifying the line 13 of file WeBackVacuumApi.py to this?

AUTH_URL = "https://user.grit-cloud.com/oauth"

it’s a different login address they use. But the one that’s working for me is “https://user.grit-cloud.com/prod/oauth”. What happens if you go to those two addresses in your browser? In both cases you should get “Missing Authentication Token”

augustin-e, I tried but it seems to be the same error.

I tried the both addresses in my browser and both return “Missing Authentication Token”

In fact I get a second error : setup of robot vaccum is taking over 10 seconds

Any chance that’s came from the credentials ? I can connect to the WeBack app.

Maybe dumb questions but the quote < > are required for the code in config.yaml ?

I guess it’s something related to credentials or something I don’t know about Home Asisstant that some one may explain later. But here’s an example (made up) of Configuration.yaml:

weback_robot_vacuum:
  username: [email protected]
  password: peter321
  region: 54

My country code es 54.

Nathan, if your credentials were wrong you would be getting a login error in your log (clear text telling you that your credentials are wrong). I think this should be some network problem. Maybe your home assistant instance can’t connect to the urls used for login. Maybe you can test/research that.

I will go that way, thank you for helping !

Ok Nathan, glad to help (or at least to try). This is my last try:

What happens if you increment the connect timeout default value used by httpx? For this, you should insert this line (setting it to 90 seconds):

timeout = httpx.Timeout(30.0, connect=90.0)

in line 63 of WebackVacuumApi.py file, so it would look like this:

timeout = httpx.Timeout(30.0, connect=90.0)
async with httpx.AsyncClient() as client:
            r = await client.post(AUTH_URL, json=data)      
            _LOGGER.debug(r)
            ...

Just to see what happens.

So I tried, with both AUTH_URL you provided earlier, same error came along

Thank you so far, I will wait and see for other users, as I will not waste your time longer :hugs:

No worries, Nathan. I really want it to work for others! I’ve finished an automation that after 3 times of full vacuum the tv is on with a message telling me to Clean the bin, lol. Do you think I should create a new topic/thread? Should be more people reading here? I hope more people can test.

Hello agustin-e, that seems to be a really great automation, useful too ! If it’s work by my side I will send a telegram notification as we start the vacuum only when we are not home. But just to be curious, what do you use to notify on your TV ?

For me this thread is related so no need to create a new topic. In the other hand, I think there is not a lot of WeBack users and even less WeBack users that uses HA. That’s just my guess !

Hi Nathan, I have an LG TV with the WebOS operating system. I created a one line shell script in ubuntu to turn on my tv by using etherwake. Then I send it a command to navigate to a page in my ubuntu server, that page receives a text parameter, the message I want to display (in case I want to use it for some other automation in the future).

1 Like

I experienced the same issue and resolved it by opening the weback app on my phone during home assistant startup.

It was only required for startup, now everything works even with the app closed.

I hope this can help you too.

and also huge thanks to @agustin-e !