when I started looking into it, i did notice from port scanning, i think when you reset and initialize with the roborock app, it changes the ports enabled vs when you initialize with the xiaomi app. i looked at the python code for miio and they are hard coding the port for xiaomi. it may be irrelevant if it’s using a different protocol all together, but wanted to throw it out there just in case it was helpful.
You are right there. So the Tuya protocol uses a different port than the standard Xiamoi protocol, that was how i started down the rabbit hole
New version:
Just update via hacs. I think I found the problem, and it should automatically recover now. Will keep an eye on my logs to make sure.
Can now reboot, and the old process wont make the new one not work, however, still recommended to kill them.
Really need to work out a way to automate that bit, will have a think
Just tested over night. For whatever reason, seems to fall over a little bit and disconnect at 3:33:40 exactly.
Whether that is my network or just general roborock who knows. However, better news, the new code changes have made it so it recovers, and seems to still be polling successfully.
Ok, 1 more thing. I seem to have made it so the node process closes if the python one does, so that should mean restarting hass now won’t cause a hanging process
@jd89 FYI, for the S6MaxV my token info isn’t in the rr_tuya_xxxxx file, it was in rr_rr_xxxx and was gziped. i have the following key titles duid, localkey, id,key and productid also of possible interest the last value says “TuyaMigrated”:false so wonder if something is coming up.
@jd89 receiving the following error any idea?
looks like bytes.fromhex(token) ValueError: non-hexadecimal number found in fromhex() arg at position 2 is the issue.
i remember from using the miiapp method, it had to be a 32 bit hex, i converted my ascii key to 32 but then in the integration it said user input malformed
so i’m not sure how to get around it
>Error while setting up roborock platform for vacuum Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform await asyncio.shield(task) File "/home/hass/.homeassistant/custom_components/roborock/vacuum.py", line 149, in async_setup_entry vacuum = Roborock(ip=host, device_id=device_id, token=token, js_dir=js_dir) File "/srv/homeassistant/lib/python3.7/site-packages/pyroborock/__init__.py", line 150, in __init__ super().__init__(ip, token, debug=debug) File "/srv/homeassistant/lib/python3.7/site-packages/miio/vacuum.py", line 91, in __init__ super().__init__(ip, token, start_id, debug) File "/srv/homeassistant/lib/python3.7/site-packages/miio/device.py", line 122, in __init__ self._protocol = MiIOProtocol(ip, token, start_id, debug, lazy_discover) File "/srv/homeassistant/lib/python3.7/site-packages/miio/miioprotocol.py", line 42, in __init__ self.token = bytes.fromhex(token) ValueError: non-hexadecimal number found in fromhex() arg at position 2
It looks like that is using the default miio component, rather than hacs
@jd89 for users that use HassOS, they can’t easily install Node or NPM. Is it possible to build a Dockerfile into the plugin to install these…in a similar way that the new AppleTV component does ?
I removed python miio and reinstalled your repo via hacs
but now it says
Unable to prepare setup for platform roborock.vacuum: Platform not found (No module named ‘miio’).
Hey, shouldnlt need to do that!
How are you adding the vacuum? Doing it via integrations->Roborock?
Not really familiar with docker to be honest.
Is it not possible just to connect to the docker, and run apt install node / apt install npm ?
HassOS doesn’t give you access to the host OS.
No. Containers are immutable, the content is kinda reset on a restart.
That’s why I created a docker file that pulls the official Home Assistant Container and adds npm
thats my Dockerfile:
from homeassistant/home-assistant:stable
RUN apk add --update nodejs npm
that I run with this script:
#!/bin/bash
docker build . --pull -t "ha_mit_npm"
and then use in this docker-compose.yaml to actually spin up HA:
version: '3'
services:
homeassistant:
container_name: home-assistant
image: ha_mit_npm:latest
# image: homeassistant/home-assistant:stable
volumes:
- ./config:/config
- ./npm/.config:/root/.config
- ./npm/.npm:/root/.npm
- ./npm/.cache:/root/.cache
environment:
- TZ=Europe/Vienna
restart: unless-stopped
network_mode: host
devices:
- /dev/serial/by-id/usb-EnOcean_GmbH_EnOcean_USB_300_DB_FT3OIZSO-if00-port0:/dev/ttyACM0
Ok cool, thanks for all the updates.
So if I was to put a docker file in the root, is there something I need to do to make it run when it gets installed / startup?
Yes, I added your custom repo in HACS, then restarted. went to integrations in HA, clicked on RoboRock, added the name, my IP, dev ID and Key. I received the following error
You indicated it may be trying to use the previous miio integration, so I removed everything and started over by re-installing your repo and then received this error
Ok. Cool, well I think you may need to add the original one back (sorry :))
For the code, I am not 100% sure, are you just using the code that you got when you followed the instructions to grab them via ADB?
Cheers
I may have made a mistake here, I think the Dockerfile in that component is for development purposes.
As a side note, I think I found where to put restart/shutdown logic in init.py.
async def async_setup_entry(hass, entry):
@callback
def on_hass_stop(event):
"""Logic for when hass stops."""
Can you please explain how to extract the file? I grabbed it via root but can’t open or read it, I tried with notepad++ and a DB Browser with no luck (I couldn’t get the adb instruction to work either)
- go to the roborock directory and manually cat the tuya file to /mnt/sdcard/roborock.gz
This is what I’m struggling with
Thank you
I mounted the virtual “sd card” in bluestacks and copied the file there.
then its accessible from the host.
its a gz file, so you need somethign that can unzip that.
or you open the json directly