Giter Club home page Giter Club logo

xiaomi-ble-mqtt's People

Contributors

algirdasc avatar apat183 avatar e-minguez avatar nicosingh avatar tayfunulu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xiaomi-ble-mqtt's Issues

Problem with btlewrap.base

Hello
I dont see to work the code
I try to put all the code in all of the folders
Python version
Raspbery PI 3b+ With Raspberian

`Traceback (most recent call last):
File "/home/pi/mitemp/data-read.py", line 2, in
from mitemp.mitemp_bt.mitemp_bt_poller import MiTempBtPoller
File "/home/pi/mitemp/mitemp/mitemp_bt/mitemp_bt_poller.py", line 8, in
from btlewrap.base import BluetoothInterface, BluetoothBackendException
ImportError: No module named 'btlewrap.base'

`

When adding more than 1 device, it crashes

Hi,

I have tested with 1 device, it works perfectly.

I have tested with 2 devices and it crashes (content of "xiaomi-ble.log"):

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/btlewrap/bluepy.py", line 55, in connect
self._peripheral = Peripheral(mac, iface=iface)
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 391, in init
self._connect(deviceAddr, addrType, iface)
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 439, in _connect
raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 58:2D:34:32:D5:BD, addr type: public

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/pi/xiaomi-ble-mqtt/data-read.py", line 48, in
temperature = poller.parameter_value(MI_TEMPERATURE)
File "/usr/local/lib/python3.5/dist-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
self.fill_cache()
File "/usr/local/lib/python3.5/dist-packages/mitemp_bt/mitemp_bt_poller.py", line 59, in fill_cache
self.firmware_version()
File "/usr/local/lib/python3.5/dist-packages/mitemp_bt/mitemp_bt_poller.py", line 89, in firmware_version
with self._bt_interface.connect(self._mac) as connection:
File "/usr/local/lib/python3.5/dist-packages/btlewrap/base.py", line 44, in enter
self._backend.connect(self._mac)
File "/usr/local/lib/python3.5/dist-packages/btlewrap/bluepy.py", line 32, in _func_wrapper
raise BluetoothBackendException() from last_error
btlewrap.base.BluetoothBackendException

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/pi/xiaomi-ble-mqtt/data-read.py", line 102, in
except bluepy.btle.BTLEException:
NameError: name 'bluepy' is not defined

Content of "devices.ini":

[living_room]
device_mac=58:2D:34:32:D5:BD
topic=ble/living
average=3

[bad]
device_mac=58:2D:34:32:D5:2E
topic=ble/bad
average=3

Any help?

Thanks!

Failed no mitemp_bt_poller.py

Hello,

i have install your script but when i started there is no mitemp_bt_poller.py to find. Where can i get this, or what i have to install?

MQTT password

Take a look at the MQTT file that seems to have your own password.

SyntaxError: invalid syntax

Hello!

When I try to run python3 data-read.py, I see this in the console:

Traceback (most recent call last): File "data-read.py", line 3, in <module> from mitemp.mitemp_bt.mitemp_bt_poller import MiTempBtPoller File "/home/pi/xiaomi-ble-mqtt/mitemp/mitemp_bt/mitemp_bt_poller.py", line 8, in <module> from btlewrap.base import BluetoothInterface, BluetoothBackendException File "/home/pi/.local/lib/python3.5/site-packages/btlewrap/__init__.py", line 23, in <module> from btlewrap.gatttool import ( File "/home/pi/.local/lib/python3.5/site-packages/btlewrap/gatttool.py", line 44 ): ^ SyntaxError: invalid syntax

Any help will be great. Thanks for your time!

Update requirements

On Ubuntu 20.04 on Raspberry Pi I had to install:

apt-get  install  libglib2.0-dev  pi-bluetooth 
pip3 install btlewrap

Problem on another device

Hi again,

I have installed your script on another device with an external BT dongle and with the same configuration (for devices), I get the following error:

Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
return func(*args, **kwargs)
File "/usr/lib/python3.7/site-packages/btlewrap/bluepy.py", line 55, in connect
self._peripheral = Peripheral(mac, iface=iface)
File "/btle.py", line 391, in init
File "/btle.py", line 439, in _connect
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 58:2D:34:32:D5:2E, addr type: public

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "data-read.py", line 49, in
temperature = poller.parameter_value(MI_TEMPERATURE)
File "/usr/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
self.fill_cache()
File "/usr/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 59, in fill_cache
self.firmware_version()
File "/usr/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 89, in firmware_version
with self._bt_interface.connect(self._mac) as connection:
File "/usr/lib/python3.7/site-packages/btlewrap/base.py", line 44, in enter
self._backend.connect(self._mac)
File "/usr/lib/python3.7/site-packages/btlewrap/bluepy.py", line 32, in _func_wrapper
raise BluetoothBackendException() from last_error
btlewrap.base.BluetoothBackendException
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
return func(*args, **kwargs)
File "/usr/lib/python3.7/site-packages/btlewrap/bluepy.py", line 55, in connect
self._peripheral = Peripheral(mac, iface=iface)
File "/btle.py", line 391, in init
File "/btle.py", line 439, in _connect
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 58:2D:34:32:D5:BD, addr type: public

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "data-read.py", line 49, in
temperature = poller.parameter_value(MI_TEMPERATURE)
File "/usr/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
self.fill_cache()
File "/usr/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 59, in fill_cache
self.firmware_version()
File "/usr/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 89, in firmware_version
with self._bt_interface.connect(self._mac) as connection:
File "/usr/lib/python3.7/site-packages/btlewrap/base.py", line 44, in enter
self._backend.connect(self._mac)
File "/usr/lib/python3.7/site-packages/btlewrap/bluepy.py", line 32, in _func_wrapper
raise BluetoothBackendException() from last_error
btlewrap.base.BluetoothBackendException
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/btlewrap/bluepy.py", line 26, in _func_wrapper
return func(*args, **kwargs)
File "/usr/lib/python3.7/site-packages/btlewrap/bluepy.py", line 55, in connect
self._peripheral = Peripheral(mac, iface=iface)
File "/btle.py", line 391, in init
File "/btle.py", line 439, in _connect
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 58:2D:34:32:D4:C4, addr type: public

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "data-read.py", line 49, in
temperature = poller.parameter_value(MI_TEMPERATURE)
File "/usr/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 125, in parameter_value
self.fill_cache()
File "/usr/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 59, in fill_cache
self.firmware_version()
File "/usr/lib/python3.7/site-packages/mitemp_bt/mitemp_bt_poller.py", line 89, in firmware_version
with self._bt_interface.connect(self._mac) as connection:
File "/usr/lib/python3.7/site-packages/btlewrap/base.py", line 44, in enter
self._backend.connect(self._mac)
File "/usr/lib/python3.7/site-packages/btlewrap/bluepy.py", line 32, in _func_wrapper
raise BluetoothBackendException() from last_error
btlewrap.base.BluetoothBackendException
Error polling device bath_room:
None
Error polling device living_room:
None
Error polling device nicolas_room:
None

Any help?

Thanks!
Jorge

Poller initialization parameters

Hi,
I have a doubt regarding the poller initialization:
poller = MiTempBtPoller(mac, BluepyBackend, ble_timeout=config[device].getint("timeout", 10))
Shouldn't it be?:
poller = MiTempBtPoller(mac, BluepyBackend, 600, 3, 'hci0', ble_timeout=config[device].getint("timeout", 10))

Best regards.

Can't read from small Xiaomi T&H Sensors

Hey,

Unfortunately can't read from small Xiaomi Bluetooth Temp & Hum sensors, known as LYWSD03MMC. There is the photo of the device: imgurl link

I have always this message:

Error polling device Bedroom BLE. Device might be unreachable or offline.

But for sure works great with MJ_TH_V1

If you have some idea how to read from LYWSD03MMC, I will be very grateful.

__init__() takes 2 positional arguments but 3 were given

Traceback (most recent call last):
  File "/usr/src/app/data-read.py", line 29, in <module>
    poller = MiTempBtPoller(mac, BluepyBackend, ble_timeout=config[device].getint("timeout", 10))
  File "/usr/src/app/mitemp/mitemp_bt/mitemp_bt_poller.py", line 34, in __init__
    self._bt_interface = BluetoothInterface(backend, adapter)
TypeError: __init__() takes 2 positional arguments but 3 were given

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.