Giter Site home page Giter Site logo

Comments (21)

rytilahti avatar rytilahti commented on July 24, 2024 1

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.

azogue avatar azogue commented on July 24, 2024 1

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.

TribuneX avatar TribuneX commented on July 24, 2024

Same issue for me after upgrading to the HASS component in version 0.49

from python-miio.

rytilahti avatar rytilahti commented on July 24, 2024

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.

jcastro avatar jcastro commented on July 24, 2024

Umm nop, I'm on the latest firmware available (just checked for new one just in case)

from python-miio.

szmania avatar szmania commented on July 24, 2024

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.

rytilahti avatar rytilahti commented on July 24, 2024

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.

szmania avatar szmania commented on July 24, 2024

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.

szmania avatar szmania commented on July 24, 2024

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.

rytilahti avatar rytilahti commented on July 24, 2024

So, there are (at least) two separate things which may cause connection failures:

  1. 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.
  2. 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.

szmania avatar szmania commented on July 24, 2024

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.

syssi avatar syssi commented on July 24, 2024

It's more or less a hack but it is working for some people:

syssi/xiaomiplug@399f8a7

from python-miio.

Isstum avatar Isstum commented on July 24, 2024

Same problem here!
Switched from custom_components to official. Running on HA 0.49, newest firmware on the vaccuum.

from python-miio.

szmania avatar szmania commented on July 24, 2024

syssi's fix seems to work. I guess capturing the exception and then refiring __enter__ did the trick.

from python-miio.

rytilahti avatar rytilahti commented on July 24, 2024

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.

syssi avatar syssi commented on July 24, 2024

I think you didn't pushed your changes. :-)

from python-miio.

rytilahti avatar rytilahti commented on July 24, 2024

Indeed, sorry! It's been pushed now.

from python-miio.

syssi avatar syssi commented on July 24, 2024

Can you prepare a new release or update the release tag? tag 0.1.2 points still to commit 4ab8efd.

from python-miio.

rytilahti avatar rytilahti commented on July 24, 2024

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.

syssi avatar syssi commented on July 24, 2024

You are right. Perfect! :-)

from python-miio.

rytilahti avatar rytilahti commented on July 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.