Hello! Recently purchased a robot vacuum cleaner that works through the WeBack cloud. Since I did not find any existing integration, I reverse-engineered the application and wrote mine.
Installation
Add custom repository to HACS and install “Weback cloud integration”: https://github.com/opravdin/weback-hass
(will publish it in HACS soon)
Or manually move component to your custom_components folder.
Configuration is simple: (email login is not working for now)
Vacuum robots that mentioned as _CLEAN_ROBOT in Amazon’s API (weback is based on Amazon IoT). I wrote a script to test your device for compatibility, it’s available in the repository.
Help required
I am new in developing hass modules, so I have some (probably dumb) questions:
Currently this integration works on polling update method, but it is possible to listen amazon’s mqtt topic for messages. Where can I see examples of integration with this approach?
I’m not sure if I implemented the polling mechanism correctly. Right now it looks like this:
@property
def should_poll(self) -> bool:
"""Return True if entity has to be polled for state."""
if self.last_fetch is None:
return True
if (
datetime.datetime.now() - self.last_fetch
).total_seconds() > self.scan_interval.total_seconds():
return True
return False
How best to pass battery_level attribute: via device_state_attributes or via @property?
Some devices (including mine) support mop mode control when garbage container replaced with water tank. There are 3 levels of water intensity in API so I want to add controls like fan’s ones. How to implement that?
I would be very grateful if someone would test the integration or check the code for errors or bad practices. I tried to follow the checklist, but I still doubt if everything is done correctly. Really want to improve the integration so that it can get into the Home Assistant core
Thank you
Logboekdetails ( ERROR )
Logger: homeassistant.setup
Source: custom_components/weback/__init__.py:47
First occurred: 19:46:47 (1 occurrences)
Last logged: 19:46:47
Error during setup of component weback
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 175, in _async_setup_component
component.setup, hass, processed_config # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/weback/__init__.py", line 47, in setup
devices = weback_api.device_list()
File "/usr/local/lib/python3.7/site-packages/weback_unofficial/client.py", line 70, in device_list
session = self.get_session()
File "/usr/local/lib/python3.7/site-packages/weback_unofficial/client.py", line 127, in get_session
region = weback_data['Region_Info']
KeyError: 'Region_Info'
I had to register a new account, as I originally registered my account using my email address. After registering with my phone number, everything worked as expected.
2020-04-16 14:36:34 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.weback. Make sure all dependencies are installed
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 391, in _load_file
module = importlib.import_module(path)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/weback/__init__.py", line 8, in <module>
from weback_unofficial.client import WebackApi
ModuleNotFoundError: No module named 'weback_unofficial'
It looks like python3 is not capable to install/find the weback_unofficial package.
Nice to hear that
AFAIK Vacuum.locate is a service which should play sound on your vacuum cleaner for you to find it in your house. Since I didn’t find it in WeBack app, this feature is not available for now. Maybe I’ll emulate it in the future by turning the robot on and off right away.
@Remco_Timmer@kwaczek@splnut
Could you please capture as many raw states as you can for me? You can check them in the bottom of the vacuum card. I need them to create aliases between Home Assistant states and WeBack ones. For example, turn robot in auto mode and write down raw state. Then put it back on charge, wait for it to finish etc.
Thank you