Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Unofficial Bluetooth controller for Pavlok

Project description

Unofficial Python Bluetooth Pavlok API

Official Pavlok API makes requests to cloud service to send message to your tablet which will send Bluetooth command to your device. Maybe it works for tablet apps, but it is a quite clumsy way to zap people.

This package controls Pavlok directly with Bluetooth commands.


  • Bluetooth 4 compatible adapter (Pavlok uses Bluetooth Low Energy)
  • Bluez
  • gattlib to interface gatttool
  • Python 2.7
  • Linux (I haven’t tested the code with anything else)


Use pip:
pip install pypavlok

Be sure to install gattlib dependencies: boost-python, boost-thread and glib2


>>> from pypavlok import PyPavlok
>>> pavlok = PyPavlok() #If MAC address is not specified, it will be found using service discovery (requires root privileges)
>>> pavlok = PyPavlok('00:07:80:B5:9A:31', 'hci0') #Or pass MAC address (doesn't require special permissions)
>>> pavlok.battery_level
>>> pavlok.shock()
>>> pavlok.shock(level=50) #50% discharge
>>> pavlok.beep()
>>> pavlok.beep(count=3, duration_on=200, duration_off=100) #3 beeps by 0.2 sec with interval 0.1 sec
>>> pavlok.led()
>>> pavlok.led(led1=False, led2=True, count=5, duration_off=300) #Blink with red LEDs 5 times by 1 sec with interval 0.3 sec
>>> pavlok.vibrate()
>>> pavlok.firmware_revision

All action methods (shock, vibrate, led, beep) share common set of parameters:

  • level: discharge percents for shock(), tone for beep(), vibration speed for vibrate(), not used in led(). Default: 50
  • count: number of repetitions. Default: 1
  • duration_on: duration of action in milliseconds (<= 5 sec). Default: 1 sec
  • duration_off: if count > 0, set the interval between repetitions in milliseconds (<= 5 sec). Default: 1 sec

Checking your setup

Check if your bluetooth adapter is up:

$ sudo hciconfig

<device name> hci0:   Type: BR/EDR  Bus: USB

<device status> DOWN

If the status is down, run:

$ sudo hciconfig <device name> up

Search for BLE devices:

$ sudo hcitool lescan

LE Scan ...

<MAC address like xx:xx:xx:xx:xx:xx> Pavlok-xxxx


Try to connect to Pavlok with gatttool:

$ gatttool -b <MAC address> -I

[<MAC address>][LE]> connect

Attempting to connect to <MAC address>

Connection successful

[<MAC address>][LE]> primary

attr handle: 0x0001, end grp handle: 0x0007 uuid: 00001800-0000-1000-8000-00805f9b34fb

attr handle: 0x0008, end grp handle: 0x001a uuid: 0000180a-0000-1000-8000-00805f9b34fb

If you got to this point, everything should work

If you encounter problems with Pavlok, try pushing The Zap Button for about 15 seconds – it will blink, vibrate and reset

Project details

Release history Release notifications

This version
History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pypavlok-0.4.tar.gz (4.3 kB) Copy SHA256 hash SHA256 Source None Jan 10, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page