bluetooth.scanner

class platypush.backend.bluetooth.scanner.BluetoothScannerBackend(device_id: Optional[int] = None, scan_duration: int = 10, track_devices: Optional[List[str]] = None, **kwargs)[source]

Bases: SensorBackend

This backend periodically scans for available bluetooth devices and returns events when a devices enter or exits the range.

Triggers:

Requires:

__init__(device_id: Optional[int] = None, scan_duration: int = 10, track_devices: Optional[List[str]] = None, **kwargs)[source]
Parameters:
  • device_id – Bluetooth adapter ID to use (default configured on the bluetooth plugin if None).

  • scan_duration – How long the scan should run (default: 10 seconds).

  • track_devices – List of addresses of devices to actively track, even if they aren’t discoverable.

get_measurement()[source]

Wrapper around plugin.get_measurement() that can filter events on specified enabled sensors data or on specified tolerance values. It can be overridden by derived classes.

on_stop()[source]

Callback invoked when the process stops

run()[source]

Starts the backend thread. To be implemented in the derived classes if the loop method isn’t defined.