{ "info": { "author": "Alexander Presnyakov", "author_email": "flagist0@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "========\npypavlok\n========\n\nUnofficial Python Bluetooth Pavlok API\n\nOfficial `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. \n\nThis package controls Pavlok directly with Bluetooth commands. \n\n--------------\nRequirements\n--------------\n* Bluetooth 4 compatible adapter (Pavlok uses Bluetooth Low Energy)\n* Bluez\n* gattlib to interface gatttool\n* Python 2.7\n* Linux (I haven't tested the code with anything else)\n\n--------------\nInstallation\n--------------\nUse pip:\n pip install pypavlok\n\nBe sure to install gattlib dependencies: boost-python, boost-thread and glib2\n\n--------------\nUsage\n--------------\n>>> from pypavlok import PyPavlok\n>>> pavlok = PyPavlok() #If MAC address is not specified, it will be found using service discovery (requires root privileges)\n>>> pavlok = PyPavlok('00:07:80:B5:9A:31', 'hci0') #Or pass MAC address (doesn't require special permissions)\n>>> pavlok.battery_level\n95\n>>> pavlok.shock()\n>>> pavlok.shock(level=50) #50% discharge\n>>> pavlok.beep()\n>>> pavlok.beep(count=3, duration_on=200, duration_off=100) #3 beeps by 0.2 sec with interval 0.1 sec\n>>> pavlok.led()\n>>> 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\n>>> pavlok.vibrate()\n>>> pavlok.firmware_revision\n'2.4.28'\n\nAll action methods (shock, vibrate, led, beep) share common set of parameters:\n\n* level: discharge percents for shock(), tone for beep(), vibration speed for vibrate(), not used in led(). Default: 50\n\n* count: number of repetitions. Default: 1\n\n* duration_on: duration of action in milliseconds (<= 5 sec). Default: 1 sec\n\n* duration_off: if count > 0, set the interval between repetitions in milliseconds (<= 5 sec). Default: 1 sec\n\n\n--------------------\nChecking your setup\n--------------------\n\nCheck if your bluetooth adapter is up:\n\n.. code-block:: console\n\n $ sudo hciconfig\n\n hci0: Type: BR/EDR Bus: USB\n\n DOWN\n\n\nIf the status is down, run:\n\n.. code-block:: console\n\n $ sudo hciconfig up\n\n\nSearch for BLE devices:\n\n.. code-block:: console\n\n $ sudo hcitool lescan\n\n LE Scan ...\n\n Pavlok-xxxx\n\n Ctrl-C\n\n\nTry to connect to Pavlok with gatttool:\n\n.. code-block:: console\n\n $ gatttool -b -I\n\n [][LE]> connect\n\n Attempting to connect to \n\n Connection successful\n\n [][LE]> primary\n\n attr handle: 0x0001, end grp handle: 0x0007 uuid: 00001800-0000-1000-8000-00805f9b34fb\n\n attr handle: 0x0008, end grp handle: 0x001a uuid: 0000180a-0000-1000-8000-00805f9b34fb\n\n\nIf you got to this point, everything should work\n\nIf you encounter problems with Pavlok, try pushing The Zap Button for about 15 seconds -- it will blink, vibrate and reset\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/flagist0/pypavlok", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "pypavlok", "package_url": "https://pypi.org/project/pypavlok/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pypavlok/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/flagist0/pypavlok" }, "release_url": "https://pypi.org/project/pypavlok/0.4/", "requires_dist": null, "requires_python": null, "summary": "Unofficial Bluetooth controller for Pavlok", "version": "0.4" }, "last_serial": 1898057, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "70b16b726b7d5ff71dfa384c2b1a1145", "sha256": "91e1d5eaa3c3d113108e4ba4e19559a38a17b5b47a2b58d0e63b26e8f8f8a730" }, "downloads": -1, "filename": "pypavlok-0.3.tar.gz", "has_sig": false, "md5_digest": "70b16b726b7d5ff71dfa384c2b1a1145", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3828, "upload_time": "2016-01-10T00:51:15", "url": "https://files.pythonhosted.org/packages/05/b7/3d33b6562aa25623625f55893dd845478045bc51b115f9661b0625957347/pypavlok-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "ad626053cadfa48edf54f0b20a86fb31", "sha256": "b6024ae668262da4b7791d4f3c31db409dffcba78d15216318aaf325085cbf3b" }, "downloads": -1, "filename": "pypavlok-0.4.tar.gz", "has_sig": false, "md5_digest": "ad626053cadfa48edf54f0b20a86fb31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4273, "upload_time": "2016-01-10T21:10:02", "url": "https://files.pythonhosted.org/packages/8b/15/584e7766fffc358e0587c15ba7511c6e76d78ae97d2a971af03d08a7503f/pypavlok-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ad626053cadfa48edf54f0b20a86fb31", "sha256": "b6024ae668262da4b7791d4f3c31db409dffcba78d15216318aaf325085cbf3b" }, "downloads": -1, "filename": "pypavlok-0.4.tar.gz", "has_sig": false, "md5_digest": "ad626053cadfa48edf54f0b20a86fb31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4273, "upload_time": "2016-01-10T21:10:02", "url": "https://files.pythonhosted.org/packages/8b/15/584e7766fffc358e0587c15ba7511c6e76d78ae97d2a971af03d08a7503f/pypavlok-0.4.tar.gz" } ] }