Comments (21)
Ok, so the cause is expired discovery/handshake, I'll release a fixed release today and make a PR to homeassistant then.
from python-miio.
Hi! I've done a PR in Home Assistant to covert the switch to a component to integrate sensors and services. The new integration, with the new release should fix this issue and more.
I'm testing it with mirobo
0.1.2 and the last firmware (3.3.9_003077), and it's working perfectly, thank you all for your work with this device!
from python-miio.
Same issue for me after upgrading to the HASS component in version 0.49
from python-miio.
Ok, this is obviously bad. I'm unsure what's the reason for this, but one possibility is the lack of doing a rediscovery now and then (I think I saw miiojs doing it every 120 seconds or so). @jcastro are you still using an older FW?
from python-miio.
Umm nop, I'm on the latest firmware available (just checked for new one just in case)
from python-miio.
Latest firmware and experiencing issue. Tried the changing of the start_id in Device class to random value from 0 to 9999 between commands, to no avail. That did work when running without HA, but with HA, not working.
from python-miio.
I think the problem is time-outing for the long-lived instances (besides some random timeouts now and then), which require a new discovery. For the time being making Device's send() to call enter() for each invocation could be a potential solution.
from python-miio.
So change this:
def send(self, command: str, parameters: Any=None) -> Any:
"""Build and send the given command."""
if self._devtype is None or self._serial is None:
self.__enter__() # when called outside of cm, initialize.
To this:
def send(self, command: str, parameters: Any=None) -> Any:
"""Build and send the given command."""
self.__enter__() # when called outside of cm, initialize.
from python-miio.
Its the start_id. I just tested it with enter solution to no avail. But with a random start_id with success.
from python-miio.
So, there are (at least) two separate things which may cause connection failures:
- The sequence number is below the number received last time from the robot and there has been no pause of a minute or so between the messages.
- There has been no discovery handshake for a while (this is just an assumption)
For the first point, randomizing the start_id won't do any good if the chosen ID will be below the previously received one, but will just get it ignored by the robot. Assuming that the ID loops after 9999 (as seen in miiojs), maybe it would make sense to send 9999 as the first ID every single time and start then counting to make sure it works. I have not yet tested this though.
To the second point, I modified it locally to do a discovery for every send as I mentioned, and even if it sometimes fails, it seems to recover just fine (running this since yesterday without problems).
from python-miio.
Hi rytilahti,
I tried your second point by calling __enter__
in every send call, without success. I still get OP error.
I will test first point, instead of randomizing but rather decrementing from 9999 as you say.
from python-miio.
It's more or less a hack but it is working for some people:
from python-miio.
Same problem here!
Switched from custom_components to official. Running on HA 0.49, newest firmware on the vaccuum.
from python-miio.
syssi's fix seems to work. I guess capturing the exception and then refiring __enter__
did the trick.
from python-miio.
I just released 0.1.2 which should finally fix this (by incrementing the message id and retrying on errors), I'll prepare a PR for homeassistant soon enough, but it would be nice if someone could test it before it hits the new release. Changing xiaomi_vacuum.py inside the homeassistant to depend on version 0.1.2 should be enough :-)
edit: PR is here: home-assistant/core#8602
from python-miio.
I think you didn't pushed your changes. :-)
from python-miio.
Indeed, sorry! It's been pushed now.
from python-miio.
Can you prepare a new release or update the release tag? tag 0.1.2 points still to commit 4ab8efd.
from python-miio.
Hm, that's the correct one though (it is the last commit on master, which bumps the version to 0.1.2 too).
from python-miio.
You are right. Perfect! :-)
from python-miio.
Thanks for getting back and for your work on the homeassistant component! :) I think this can be closed now.
from python-miio.
Related Issues (20)
- Unsupported Model roborock.vacuum.a72
- Mi Smart Power Plug 2 (chuangmi.plug.212a01) requires real did for multirequests HOT 4
- Unsupported Model Xiaomi Purifier Elite
- PhilipsEyecare 9290013821 is working just fine HOT 1
- Heatold Thermostat TH1230W [cubee.airrtc.1230w] HOT 1
- Unsupported model - Xiaomi Smart Lightstrip Pro - philips.light.strip5 HOT 2
- is mijia.camera.v1 supported HOT 1
- Unable to find mapping for zhimi.airp.mb3a, falling back to zhimi.airpurifier.ma4 HOT 4
- Roborock App Support HOT 2
- Unsupported Model: Xiaomi Air Purifier 4 Lite (zhimi.airp.rma2) HOT 1
- Improve handling of unexpected device responses
- v6: Multiple Roborock devices swap attributes HOT 2
- Unsupported Aqara Double Switch
- xiaomi vacuum cleaner s12 HOT 2
- Roborock S8 - roborock.vacuum.a51 HOT 1
- Roborock S8 is roborock.vacuum.a51
- Request new Vacuum Mijia Robot Vacuum M30 Pro HOT 1
- Xiaomi trouver lds finder doesn't work HOT 3
- No set_voice implemented for dreame.vacuum.r2205
- The response time to get the current power usage varies a lot HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-miio.