bluepy | Python interface to Bluetooth LE on Linux

 by   IanHarvey C Version: 1.3.0 License: Non-SPDX

kandi X-RAY | bluepy Summary

kandi X-RAY | bluepy Summary

bluepy is a C library typically used in Networking, Raspberry Pi applications. bluepy has no bugs, it has no vulnerabilities and it has medium support. However bluepy has a Non-SPDX License. You can download it from GitHub, GitLab.

Python interface to Bluetooth LE on Linux. This is a project to provide an API to allow access to Bluetooth Low Energy devices from Python. At present it runs on Linux only; I’ve mostly developed it using a Raspberry Pi, but it will also run on x86 Debian Linux. The code is tested on Python 2.7 and 3.4; it should also work on 3.3. There is also code which uses this to talk to a TI SensorTag (www.ti.com/sensortag). An example to interface the Nordic Semiconductor ASA IoT Sensor Kit, Thingy:52 is available in thingy52.py (
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              bluepy has a medium active ecosystem.
              It has 1523 star(s) with 488 fork(s). There are 102 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 221 open issues and 171 have been closed. On average issues are closed in 134 days. There are 13 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of bluepy is 1.3.0

            kandi-Quality Quality

              bluepy has 0 bugs and 147 code smells.

            kandi-Security Security

              bluepy has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              bluepy code analysis shows 0 unresolved vulnerabilities.
              There are 4 security hotspots that need review.

            kandi-License License

              bluepy has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              bluepy releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.
              It has 2312 lines of code, 226 functions and 12 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of bluepy
            Get all kandi verified functions for this library.

            bluepy Key Features

            No Key Features are available at this moment for bluepy.

            bluepy Examples and Code Snippets

            No Code Snippets are available at this moment for bluepy.

            Community Discussions

            QUESTION

            pip install error with Raspberry OS 64 bit
            Asked 2022-Apr-01 at 09:03

            Have anyone know how to solve this error?

            ...

            ANSWER

            Answered 2022-Mar-07 at 06:17

            QUESTION

            A way to apply Kalman filtering on each BLE device separately using python
            Asked 2021-Dec-06 at 06:30

            I am trying to get filtered RSSI values of each BLE beacon using Kalman filtering. I cannot use a single instance of kalman filtering on all BLE devices, how to map or assign a instance of kalman filter for each BLE device. I know it has something to do with maps but cannot figure out how to implement it. Any help would be much appreciated.

            ...

            ANSWER

            Answered 2021-Dec-06 at 06:30

            I don't think map is the correct solution for this problem. An instance of the filter stored in a dictionary and keyed by the device address would seem a better solution. For example:

            Source https://stackoverflow.com/questions/70225082

            QUESTION

            blupy read value from chacteristics as integer and not as ascii
            Asked 2021-Aug-26 at 14:22

            I use the bluepy module to connect to an Arduino board with BLE running a battery monitor.

            My Python script is working perfectly fine. I get the values I expect. But I do not like the solution because the binary value read from the characteristic is interpreted as an ASCII character before getting the decimal representation of that ASCII character.

            I tried to use the binascii module

            ...

            ANSWER

            Answered 2021-Aug-26 at 14:22

            The characteristic read is returning bytes e.g b'/'. If you want to convert that into an integer then the int.from_bytes() functionality is useful. e.g:

            Source https://stackoverflow.com/questions/68938678

            QUESTION

            Nordic Thingy52 btle Color Sensor data decoding
            Asked 2021-Feb-08 at 13:52

            Used lang is Python.
            I am trying to decode the color sensor data from the Thingy52 to RGBA. To interface with the Thingy52 I use the thingy52.py example in https://github.com/IanHarvey/bluepy/tree/master/bluepy Four examples of the received raw data:

            ...

            ANSWER

            Answered 2021-Feb-08 at 13:52

            If I have found the correct Nordic documentation, then they are 4 uint16

            So in python you could do:

            Source https://stackoverflow.com/questions/66101430

            QUESTION

            BLE communication between two Raspberry Pi 4
            Asked 2021-Feb-01 at 15:59

            I am collecting pressure sensor data from 4 Arduino Nano 33 ble to a raspberry pi 4. I am able to receive the data from all the sensors. Now, I want to send this received data to another Raspberry Pi 4 using BLE communication in real-time such that the first Raspberry Pi acts as a repeater. I searched but could not find a suitable approach or solution to implement this. The first Raspberry Pi could act as a peripheral/client sending all the received sensor data and the second raspberry pi could act as a central/server to receive all the sensor data which can be further displayed on web interfaces or stored in a database.

            I tried connecting initially with one Arduino and sending its data over raspberry Pi. I have written the code for Raspberry Pi Client and Server using Bluedot library in Python.

            Raspberry Pi 4 Client code

            ...

            ANSWER

            Answered 2021-Feb-01 at 15:59

            Found the solution.

            Create the client once outside the while loop and then the data transfer happens.

            updated loop function.

            Source https://stackoverflow.com/questions/65935999

            QUESTION

            BluePy Frequent BLE Disconnects between Raspberry Pi4 and ESP32 - (Bluetooth)
            Asked 2020-Dec-19 at 15:34

            I (like others) have multiple disconnects between a RPi4 central(client) and ESP32 BLE peripheral(server). Using the "nRF Connect" app on a android phone, the connection to the ESP32 is robust. However, RPi4 - ESP32 BLE communication is VERY unstable. This finding implies the fault is with the RPi and/or code. The initial BLE connection occurs faithfully but the connection inevitably drops after a random number of successful reads (usually 1-50 reads). I am using BluePy 1.3.0 with a new Raspbian image on a RPI4. I attached skeleton code and the error message produced after a random number of successful Reads.

            ...

            ANSWER

            Answered 2020-Dec-19 at 15:34

            There are a large number of things it could be but there a couple areas that I would investigate.

            Firstly there is a bit churn going on with Bluetooth firmware on the RPi at the moment as you can see from this thread: https://github.com/RPi-Distro/firmware-nonfree/issues/8

            So I would check that you are up to date with with those.

            BluePy I believe has a bluepy-helper module which is based on Bluez version 5.47 which is behind what the RPi is using now. Might be worth trying a different library to see if the issue persists.

            Here is an example of reading your characteristic with the BlueZ D-Bus API directly using pydbus for the python D-Bus bindings:

            Source https://stackoverflow.com/questions/65366042

            QUESTION

            Updating jquery with realtime sensor data through flask
            Asked 2020-Dec-15 at 11:27

            I am trying to send realtime data from a sensor through flask to the front-end through jquery. Right now my script uses setInterval(..., 1000); to update the data through a ajax request.

            However, I would like to update the jquery request when new sensordata is received from flask, as the framerate from the sensor differ and its hard to set a specific interval to make it realtime.

            Is it possible to use some kind of signal in the jquery code when new data is sent through @app.route('/data')?

            Python script:

            ...

            ANSWER

            Answered 2020-Dec-15 at 11:27

            For realtime data, use 'text/event-stream' MIME type

            return Response(generate_random_data(), mimetype='text/event-stream')

            or yield a server-side event (i used this type with the below snippet)

            Here is part of a front-end snippet i used:

            Source https://stackoverflow.com/questions/65304692

            QUESTION

            can't connect multiple HC-08 to raspberry pi using bluepy and Bluez
            Asked 2020-Nov-14 at 10:19

            I'm trying to connect two Arduino device to the raspberry pi using the csr 4.0 dongle. I've tried python3 and bluepy, but always one of them failed to connect! I've also tried to connect to them using bluetoothctl at the same time, but I got this:

            ...

            ANSWER

            Answered 2020-Sep-14 at 16:20

            It should be possible to connect to BLE devices to your Raspberry Pi at the same time. You mention about the CSR 4.0 dongle so your setup might vary from a typical setup because you have two adapters?

            I suspect if you listed your Bluez service you will have hci0 and hci1 representing the inbuilt adapter and the CSR dongle. In the list will also be the devices that you have paired with. You will need to use the correct hci path for the devices you want to connect to

            Source https://stackoverflow.com/questions/63886960

            QUESTION

            Bluetooth LE Advertisment Packet format doesn't match Bluetooth specifications
            Asked 2020-Jun-29 at 08:31

            i'm trying to connect to a bluetooth le body scale with my raspberry pi. Because i can't connect to it, whether if i use python-bluepy or gatttool i tried to get more information and read the advertisment packet with sudo hcitool lescan --duplicates & and sudo hcidump --raw. I download the Bluetooth Core Specification for versions from 4.0 to 5.1 from bluetooth.com. But the data i get from hcidump does not match the bluetooth specifications exactly. I tried other devices, an iPhone 7, Sony WH-1000MX3 and Oculus Quest. They all send LE packets but all in the (in my opinion) non-standard packet format. This is a packet i received from the scale (mac a0:91:53:e2:58:db): 04 3E 2B 02 01 03 00 DB 58 E2 53 91 A0 1F 02 01 04 03 03 B0 FF 0F FF AC A0 DB 58 E2 53 91 A0 A2 AD A0 A3 06 B8 07 09 41

            The first thing, that i don't understand is the preamble 04. All of my devices use this. But the specification says advertisment packet should have a preamble of 0xAA. And even data packets should have 0xAA or 0x55. But never 0x04. Next thing is the access address. For advertisment should be 0x8E89BED6 but not a single one of my devices use this. I also don't unserstand the PDU header. Lenght is 0. The payload almost matches the specification, but there is a byte after the hardware address (1F) that shouldn't be there. As i said, all of my devices use this format ("wrong" preamble, access address, PDU header, additional byte in Payload). And some devices have only one byte CRC. So i am wondering if i understand something completly wrong. Can anyone explain what kind of package those are or why they don't match the specification?

            BLE Advertisment Package

            ...

            ANSWER

            Answered 2020-Jun-29 at 08:31

            What you see in hcitool is the HCI encoded packet, not the original Link Layer packet.

            0x04 is the hci packet indicator for HCI Event packet. The rest is an LE Advertising Report event.

            The 0x03 two positions before the address means ADV_NONCONN_IND, which means the device does not accept connections currently. Maybe your scale has a button or something you need to press first to make it connectable.

            Source https://stackoverflow.com/questions/62633648

            QUESTION

            How to setup the enviroment that bluepy can scan without sudo?
            Asked 2020-Jan-18 at 06:59

            I wrote some Python3 script, that scans for devices. If they match a "name" I am connecting to them and do some ble stuff. The script is build on top of the bluepy module.

            One think I don't like, is that I need to run the device scanning as sudo(like sudo python3 getDev.py). Any ideas how to make a user being able to scan without root rights?

            Guess I need to add the local user to a group etc. Any ideas are welcome

            ...

            ANSWER

            Answered 2020-Jan-18 at 06:59

            On linux Bluetooth protocol stack need special privileges to interact with.

            These privileges are implemented through properties called capabilities, see man 7 capability for details.

            The tool to assign capabilities is the program setcap.

            In case of bluepy it is the binary bluepy-helper that interact with the bluetooth protocol stack, so locate where it is installed the package bluepy and run:

            Source https://stackoverflow.com/questions/59786226

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install bluepy

            The code needs an executable bluepy-helper to be compiled from C source. This is done automatically if you use the recommended pip installation method (see below). Otherwise, you can rebuild it using the Makefile in the bluepy directory.

            Support

            Documentation can be built from the sources in the docs/ directory using Sphinx. An online version of this is currently available at: http://ianharvey.github.io/bluepy-doc/.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install bluepy

          • CLONE
          • HTTPS

            https://github.com/IanHarvey/bluepy.git

          • CLI

            gh repo clone IanHarvey/bluepy

          • sshUrl

            git@github.com:IanHarvey/bluepy.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular C Libraries

            linux

            by torvalds

            scrcpy

            by Genymobile

            netdata

            by netdata

            redis

            by redis

            git

            by git

            Try Top Libraries by IanHarvey

            pcc

            by IanHarveyC

            minicrypt

            by IanHarveyC

            net-monitor

            by IanHarveyPython

            bluepy.device

            by IanHarveyPython

            arduino-daq

            by IanHarveyC++