martinohanlon / BlueDot

A zero boiler plate bluetooth remote
MIT License
144 stars 45 forks source link

can't bluedot be used in devices other than raspberry pi ? #182

Closed InfictionLabs closed 1 year ago

InfictionLabs commented 1 year ago

Fill in the details or delete as appropriate :)

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

or

Run this program

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

System (please complete the following information):

Additional context Add any other context about the problem here.

martinohanlon commented 1 year ago

Define device?

The bluedot python library will/should run on machines running Linux with a Bluetooth backend (e.g. bluez). e.g. it would run a laptop running Ubuntu.

On Mon, 2 Jan 2023, 12:40 InfictionLabs, @.***> wrote:

Fill in the details or delete as appropriate :)

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

or

Run this program

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

System (please complete the following information):

  • OS: [e.g. Raspbian]
  • Version [e.g. Buster]

Additional context Add any other context about the problem here.

— Reply to this email directly, view it on GitHub https://github.com/martinohanlon/BlueDot/issues/182, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARYXHLUIIPT5QNMWZT5YCLWQLECNANCNFSM6AAAAAATOZCYMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

virtadpt commented 1 year ago

@martinohanlon Can confirm.

InfictionLabs commented 1 year ago

we are using imx8m mini som with a yocto build. installed bluedot using pip3 install bluedot. installation worked successfully. but when we run the example code it shows the following error

File "/root/test.py", line 2, in bd = BlueDot() File "/usr/lib/python3.9/site-packages/bluedot/dot.py", line 844, in init self.start() File "/usr/lib/python3.9/site-packages/bluedot/dot.py", line 1175, in start self._server.start() File "/usr/lib/python3.9/site-packages/bluedot/btcomm.py", line 351, in start self._server_sock = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM) AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH'

please help me know if any supporting libraries or packages are missing.

InfictionLabs commented 1 year ago

Define device? The bluedot python library will/should run on machines running Linux with a Bluetooth backend (e.g. bluez). e.g. it would run a laptop running Ubuntu. On Mon, 2 Jan 2023, 12:40 InfictionLabs, @.> wrote: Fill in the details or delete as appropriate :) Describe the bug A clear and concise description of what the bug is. To Reproduce Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error or Run this program Expected behavior A clear and concise description of what you expected to happen. Screenshots If applicable, add screenshots to help explain your problem. System (please complete the following information): - OS: [e.g. Raspbian] - Version [e.g. Buster] Additional context Add any other context about the problem here. — Reply to this email directly, view it on GitHub <#182>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARYXHLUIIPT5QNMWZT5YCLWQLECNANCNFSM6AAAAAATOZCYMA . You are receiving this because you are subscribed to this thread.Message ID: @.>

thanks for the reply

martinohanlon commented 1 year ago

AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH

I am pretty sure this is because the build of Python that is being used hasnt been compiled with the relevant bluetooth "extensions" - I am being vague here because this isnt an area of expertise for me.

ukBaz commented 1 year ago

@InfictionLabs,

I agree with Martin that this is likely to a lower level dependency that isn't there. Yocto tends to be very basic by default.

You might want to check that BlueZ is installed correctly and up and running:

service bluetooth status

You can also check that you can scan and connect to a device with the Bluetooth command line tool:

bluetoothctl

You can check that Bluetooth sockets is in Python with the following couple of lines.

import socket
s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)

Once those lower level things are in place there should be a good chance that BlueDot will work as expected.

InfictionLabs commented 1 year ago

any packages that we installed or build through yocto showed "module 'socket' has no attribute 'AF_BLUETOOTH" error.

martinohanlon commented 1 year ago

any packages that we installed or build through yocto showed "module 'socket' has no attribute 'AF_BLUETOOTH" error.

Yes, I am pretty sure that is because Python has been built without bluetooth support.

martinohanlon commented 1 year ago

I was looking at something else and came across this issue on another project including some instructions for building Python with Bluetooth support - it might be helpful for you.

https://github.com/custom-components/ble_monitor/issues/125#issuecomment-713355926

martinohanlon commented 1 year ago

I am going to close this issue as the root cause is not a fault with bluedot. If I can provide any further advice I am happy to.