rytilahti / python-miio

Python library & console tool for controlling Xiaomi smart appliances
https://python-miio.readthedocs.io
GNU General Public License v3.0
3.63k stars 549 forks source link

Roborock S6 - Partially works only on < 01.07.74 firmware on S6 #756

Open edif30 opened 4 years ago

edif30 commented 4 years ago

Hello,

I just purchased a Roborock S6. I have an S5 and everything works great. Including integration with Home Assistant. After initial setup I have noticed that the S6 doesn't properly integrate into Home Assistant.

[homeassistant.components.xiaomi_miio.vacuum] Got exception while fetching the state: Unable to request miIO.info from the device

Troubleshooting further I used python-miio to check status.

$  miiocli vacuum --ip <IP> --token <token> status
Running command status
<VacuumStatus state=Charging, error=No error bat=100%, fan=102% cleaned 58.9325 m² in 1:03:41>

The vacuum responds. But doesn't work in Home Assistant. I even updated my Home Assistant python-miio to the latest version just to be safe.

I checked the firmware of the S6 and its stock out of the box version was 01.05.28. There was an update available to 01.07.74. I upgraded and upon reboot the vacuum becomes unresponsive from python-miio. You cannot even do a discovery handshake to get the token.

$ miiocli vacuum --ip <IP> --token <token> status
Running command status
ERROR:miio.miioprotocol:Unable to discover a device at address <IP>
Error: Unable to discover the device <IP>

I downgraded to stock 01.05.28 and the vacuum becomes available again.

$  miiocli vacuum --ip <IP> --token <token> status
Running command status
<VacuumStatus state=Charging, error=No error bat=100%, fan=102% cleaned 58.9325 m² in 1:03:41>

So it seems that upon upgrade to 01.07.74 breaks access to the vacuum via python-miio. Also, Home Assistant on 01.05.28 does not work and throws the error...

[homeassistant.components.xiaomi_miio.vacuum] Got exception while fetching the state: Unable to request miIO.info from the device

Are these issues known? on 01.05.28 I can start, stop, and pretty much control the S6 with python-miio as I please. But with the lack of Home Assistant availability as well as upgrading to 01.07.74, this leaves a very small window of usage. I am curious if this is known and if so, are there any developments to get this working? I am willing to help in any way by collecting logs, troubleshooting, etc. I do not know python or the code the vacuum runs on but I am willing to help and lend a hand in any way.

Thanks!

rytilahti commented 4 years ago

Hi,

that "Unable to request miIO.info from the device" error should be captured right over here: https://github.com/rytilahti/python-miio/blob/master/miio/vacuum.py#L457 . Please run miiocli -d vacuum --ip $MIROBO_IP --token $MIROBO_TOKEN fan_speed_presets after replacing the variables to get some debug output, here's what it does on my gen1:

DEBUG:miio.miioprotocol:xx.xx.xx.xx:54321 >>: {'id': 261, 'method': 'miIO.info', 'params': []}
DEBUG:miio.protocol:Unable to parse json '': Expecting value: line 1 column 1 (char 0)
DEBUG:miio.vacuum:Unable to query model, falling back to <enum 'FanspeedV1'>
{'Silent': 38, 'Standard': 60, 'Medium': 77, 'Turbo': 90}

For the problems with the newer firmware, it can very well be that they are blocking the access on newer firmwares, or maybe the behavior is just different when connected to the cloud or not? These devices are pretty much blackboxes if you don't reverse the firmware images, so it's hard to be sure.

edif30 commented 4 years ago

It seems my token is now hidden when doing a discovery handshake. Nothing changed as far as firmware. I am still on the stock 01.05.28. Except now I think the token changed on the vacuum. I had the vacuum paired with the Roborock App before on this version and the vacuum would respond. I am wondering if after a certain time the token changes. I'm going to upgrade to .74 again because I cannot control the vacuum with python-miio anyway at this point. S5 still works great on its latest version.

rytilahti commented 4 years ago

I have heard reports that some firmwares (or some devices) do a factory reset in some error conditions (unable to connect to the cloud?). Maybe that's related?

lodegaard commented 4 years ago

My S6 is currently running firmware version 01.07.88, and I also get the 'Unable to discover the device' error message. From Wireshark I see that there is an ICMP 'Destination Unreachable (Port Unreachable)' being sent from the S6 when commands are executed.

I tried dumping the the traffic on my switch when running some commands in the app, but there is no UDP traffic between my phone and the vacuum. Did the block local access, or am I missing something? Hope it's the latter.

bobfrogg commented 7 months ago

My S6 is currently running firmware version 01.07.88, and I also get the 'Unable to discover the device' error message. From Wireshark I see that there is an ICMP 'Destination Unreachable (Port Unreachable)' being sent from the S6 when commands are executed.

I tried dumping the the traffic on my switch when running some commands in the app, but there is no UDP traffic between my phone and the vacuum. Did the block local access, or am I missing something? Hope it's the latter.

Did you ever solve this? Im seeing similar things with my Q7