I'm working with BLE on raspberry pi right now and I'm using bluepy library for python.
Scanning for devices works fine, but I want to find just few beacon devices without wasting time for searching all other devices available nearby.
In other words - I have a list of my beacons addresses and I want to check if any of them are in area. Can I simply walk throw that list and check if this specific device is in area to avoid time consuming scanning all devices?
Related
I am working on a project that requires knowing the bluetooth or wifi MAC adresses of local IOS devices but whenever the IOS device is not in the settings screen for bluetooth, the device is not discoverable. This is a problem because the program needs to scan all local IOS devices no matter if the settings screen is open. I am considering switching to using wifi mac addresses if there is a way to extract them when not being connected to the same network or even on a network at all just in the same area. It wouldn't need to be long-range only find some sort of always-broadcasting unique identifier short distances (I know IP adresses can change so I avoided using them) that can be found without being connected to a certain wifi or being discoverable on bluetooth. Is there a solution that would work with python and IOS? Thanks for any responses in advance!
I'm using python to get the current selected audio device in windows. I'm using pyaudio now and open to use other libs.
What I have achieved:
with pyaudio's get_device_info_by_index I can list all audio devices.
with pyaudio's get_default_output_device_info I can get the default audio device(seems to me it's the internal audio device embedded in PC)
What I have tried:
If I plug in my headphone or connect the PC to some bluetooth speaker, I can use get_device_info_by_index to get new plugged devices. But get_default_output_device_info still gives me the default PC speaker.
So I need a way to find out the current selected speaker. For example, I connect headphone and bluetooth speaker to the PC, so I have 3 output speakers. Then I can use windows's control panel to select a speak to use.
I need a way to find out which one is selected in Python, either pyaudio or any other libs.
I just got a wifi pineapple nano, and have been a longtime raspberry pi enthusiast, so I'm super stoked to start joining the two. I've already got it connected to my Pi and have played around a bit with the setup. My specific curiosity right now is whether it's possible to write a program to perform GPIO tasks on the raspberry pi based on events occurring on a wireless LAN broadcast by the pineapple. An example would be to turn an LED on if a specific MAC address is detected, and said client is within some power threshold. My lack of knowledge at this stage is how the pineapple fits with the pi (or any other "host" for that matter).
Specifically, do I write my program (probably python, and later some html and JavaScript served over flask) and host it on the pi? If so, how does it interact with the pineapple to get the MAC address and connection power dB? If not, do I host it on the pineapple? If so, how does the program interact with the pi to utilize its GPIO pins? How would I compile my code so that the pineapple can use it? Are there modules already available that can get me most of the way to my goal?
I don know Pineapple Nano very much, but I found, there is an API with module Tracking.
API You should be able to set script which will run when client with specific MAC address connect to AP. In script you can call some method API/Flask on your Pi.
Next solution can be gpiozero library, which has module pingserver doc,
where you can checking some URL if is online. If you set on your AP static IP addresses for clients you want to track, you can use this module to determine, if is online (connected) or offline (disconnected)
example:
from gpiozero import PingServer, LED
from signal import pause
client= PingServer('192.168.0.155')
led = LED(4)
led.source_delay = 60 # check once per minute
led.source = client.values
pause()
In this example, when client with IP address 192.168.0.155 go online, LED will turn on.
Maybe it will help you.
Peace
I am writing software for a Raspberry Pi based robot device.
I want the robot to stop and react when it moves too far from the wifi transmitter before it loses signal completely.
Is there an easy way in Python to get a value of the strength or quality of the current wifi connection so I can monitor this?
I'm connecting a several identical USB-MIDI devices and talking to them using Python and pyportmidi. I have noticed that when I run my code on Linux, occasionally the MIDI ports of the devices are enumerated in a different order, so I send messages to the wrong devices. As the devices do not have unique identifiers, I am told that I should identify them by which USB port they are connected to.
Is there any way to retrieve this information? My app will run on Linux, but Mac OS support is useful for development.
It's annoying because they usually enumerate in a sensible order - the first device in the hub is the first device in portmidi, but sometimes they don't - usually the first 2 devices are switched. I have to physically move the devices without unplugging to fix them.
lsusb should do the trick. All devices and their respective hubs are listed there.