I am trying to detect if my bluetooth speaker is connected to my rpi3 with my python code, executing this command

status = subprocess.call('ls /dev/input/event0 2>/dev/null', shell=True)

if the directory /dev/input/event0 exists, then it will pass the check. However, the directory is never created even after I connect my bluetooth speaker and have already tested it by playing smth from it. Below is the output when I run the command ls /dev/input

enter image description here

How else can I check if the speaker is connected using a python script?

  • rpi3 os version: jessie
  • python: python 3.4

1 Answer 1


I've been looking at doing something similar, but I've not actually gotten around to trying it... and so you have a chance to be a true pioneer here :) In addition, this is not the only solution, or even the best one, but it's the one I'm going to try. Note that the steps to install the dependencies and get the actual code are embedded in this post from Nov, 2016.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.