Coder Social home page Coder Social logo

Comments (16)

insertjokehere avatar insertjokehere commented on June 5, 2024 2

I'm running into this (one of my sensors 'drifts' in and out of Bluetooth range, so I'm seeing this pretty often) - will try out the fix @jboeddeker and @JoanMCD over the next few days and put up a PR unless someone beats me to it

from miflora-mqtt-daemon.

jboeddeker avatar jboeddeker commented on June 5, 2024 1

That's exactly what i did. :-D

I am testing it currently. I will do a PR when i am confident this helps.

from miflora-mqtt-daemon.

kaned avatar kaned commented on June 5, 2024 1

Thomas, thanks for adding this in and maintaining this daemon. It works great and makes it much easier to work with the MiFlora!

from miflora-mqtt-daemon.

ThomDietrich avatar ThomDietrich commented on June 5, 2024

Thanks for the bug report!
As I am not able to do serious development right now I would very much appreciate if one of the others reading could have a look. Thanks!

from miflora-mqtt-daemon.

jboeddeker avatar jboeddeker commented on June 5, 2024

I enjoy the same. At first, i configured the service as restart=always, but that doesn't help.

I am quite clueless regarding python, but i did a change. I added the "BluetoothBackendException" which is raised by the backend to the "IOError" Exception handler.

Similar is in line 314. Only IOError Exception is handled, but BluetoothBackenException is raised.

But as i said, i am clueless with python, this may be nonsense.

from miflora-mqtt-daemon.

ThomDietrich avatar ThomDietrich commented on June 5, 2024

Hey guys, I had a quick look.
You are on the right track. Simply replace IOError by the new more specific one. As I didn't check if an IOError could still occur, let's catch both.

Please replace those two lines:

by

except (IOError, BluetoothBackendException):

If you can proof the correct behavior please let me know and I'll add the change (or you can push a PR!) Thanks!

from miflora-mqtt-daemon.

JoanMCD avatar JoanMCD commented on June 5, 2024

@jboeddeker good job, thank you very much!!

line 15:
from btlewrap import available_backends, BluepyBackend, GatttoolBackend, PygattBackend, BluetoothBackendException

from miflora-mqtt-daemon.

jboeddeker avatar jboeddeker commented on June 5, 2024

Thanks. I currently just use the import of BluetoothBackendException. Are all of these neccessary?

Line 15:
from miflora.backends.gatttool import GatttoolBackend, BluetoothBackendException

Service doesn't stop anymore, although i have an unreachable sensor.

from miflora-mqtt-daemon.

JoanMCD avatar JoanMCD commented on June 5, 2024

hmm, no.
I only want to hint that in comparism with the original code I have to add the BluetoothBackendException

BluepyBackend and PygattBackend are alternative backends. BluepyBackend is more stabile as I read, but I still use GatttoolBackend

from miflora-mqtt-daemon.

ThomDietrich avatar ThomDietrich commented on June 5, 2024

Exchanging the backend would be the main task for a next version.
If any of you wants to create a PR with the needed changes, that would be very much appreciated!

from miflora-mqtt-daemon.

jboeddeker avatar jboeddeker commented on June 5, 2024

OK, i made the changes. Works fine. But i am confused with github. (Not really used to it, still use SVN for all my projects.)

I made the changes in the version installed on my pi with openHABian. Works.
I created a fork and a branch, but this is a more recent version (some work is done to the backends). Cloned my fork, changed it and this works as well.

But how can i apply the changes to the version which was cloned to my pi by openhabian? This is a simple bugfix and people needing the bugfix, shouldn't go to a new version manually to obtain this.

from miflora-mqtt-daemon.

ThomDietrich avatar ThomDietrich commented on June 5, 2024

In order to create a PR here you could actually just work with the GitHub provided editor. As the program is just one script file it is easy to add all changes, then create a PR based on that. After the PR was accepted and merged, you should be able to update your setup on the Pi by re-executing the openhabian-config step.

from miflora-mqtt-daemon.

ThomDietrich avatar ThomDietrich commented on June 5, 2024

Hey guys, are you still working on this PR?

from miflora-mqtt-daemon.

Hypfer avatar Hypfer commented on June 5, 2024

Whats the status on this?

from miflora-mqtt-daemon.

kaned avatar kaned commented on June 5, 2024

Any update on this?

from miflora-mqtt-daemon.

ThomDietrich avatar ThomDietrich commented on June 5, 2024

Deeply sorry for the delay guys. This should be solved now.

from miflora-mqtt-daemon.

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.