==========
pykulersky
==========
.. image:: https://img.shields.io/pypi/v/pykulersky.svg
:target: https://pypi.python.org/pypi/pykulersky
.. image:: https://github.com/emlove/pykulersky/workflows/tests/badge.svg
:target: https://github.com/emlove/pykulersky/actions
.. image:: https://coveralls.io/repos/emlove/pykulersky/badge.svg
:target: https://coveralls.io/r/emlove/pykulersky
Library to control Brightech Kuler Sky Bluetooth LED smart lamps
* Free software: Apache Software License 2.0
Features
--------
* Discover nearby bluetooth devices
* Get light color
* Set light color
Command line usage
------------------
pykulersky ships with a command line tool that exposes the features of the library.
.. code-block:: console
$ pykulersky discover
INFO:pykulersky.discovery:Starting scan for local devices
INFO:pykulersky.discovery:Discovered AA:BB:CC:00:11:22: Living Room
INFO:pykulersky.discovery:Discovered AA:BB:CC:33:44:55: Bedroom
INFO:pykulersky.discovery:Scan complete
AA:BB:CC:00:11:22: Living Room
AA:BB:CC:33:44:55: Bedroom
$ pykulersky get-color AA:BB:CC:00:11:22
INFO:pykulersky.light:Connecting to AA:BB:CC:00:11:22
INFO:pykulersky.light:Got color of AA:BB:CC:00:11:22: (0, 0, 0, 255)'>
000000ff
$ pykulersky set-color AA:BB:CC:00:11:22 ff000000
INFO:pykulersky.light:Connecting to AA:BB:CC:00:11:22
INFO:pykulersky.light:Changing color of AA:BB:CC:00:11:22 to #ff000000
$ pykulersky set-color AA:BB:CC:00:11:22 000000ff
INFO:pykulersky.light:Connecting to AA:BB:CC:00:11:22
INFO:pykulersky.light:Changing color of AA:BB:CC:00:11:22 to #000000ff
Usage
-----
Discover nearby bluetooth devices
.. code-block:: python
import asyncio
import pykulersky
async def main():
lights = await pykulersky.discover(timeout=5)
for light in lights:
print("Address: {} Name: {}".format(light.address, light.name))
asyncio.get_event_loop().run_until_complete(main())
Turn a light on and off
.. code-block:: python
import asyncio
import pykulersky
async def main():
address = "AA:BB:CC:00:11:22"
light = pykulersky.Light(address)
try:
await light.connect()
await light.set_color(0, 0, 0, 255)
await asyncio.sleep(5)
await light.set_color(0, 0, 0, 0)
finally:
await light.disconnect()
asyncio.get_event_loop().run_until_complete(main())
Change the light color
.. code-block:: python
import asyncio
import pykulersky
async def main():
address = "AA:BB:CC:00:11:22"
light = pykulersky.Light(address)
try:
await light.connect()
while True:
await light.set_color(255, 0, 0, 0) # Red
await asyncio.sleep(1)
await light.set_color(0, 255, 0, 0) # Green
await asyncio.sleep(1)
await light.set_color(0, 0, 0, 255) # White
await asyncio.sleep(1)
finally:
await light.disconnect()
asyncio.get_event_loop().run_until_complete(main())
Get the light color
.. code-block:: python
import asyncio
import pykulersky
async def main():
address = "AA:BB:CC:00:11:22"
light = pykulersky.Light(address)
try:
await light.connect()
color = await light.get_color()
print(color)
finally:
await light.disconnect()
asyncio.get_event_loop().run_until_complete(main())
Changelog
---------
0.5.5 (2023-04-07)
~~~~~~~~~~~~~~~~~~
- Support CI for bleak 0.20
0.5.4 (2022-05-03)
~~~~~~~~~~~~~~~~~~
- Unpin test dependencies
0.5.3 (2021-11-23)
~~~~~~~~~~~~~~~~~~
- Support CI for bleak 0.13
0.5.2 (2021-03-04)
~~~~~~~~~~~~~~~~~~
- Use built-in asyncmock for Python 3.8+
0.5.1 (2020-12-23)
~~~~~~~~~~~~~~~~~~
- Include default timeout on all API calls
0.5.0 (2020-12-19)
~~~~~~~~~~~~~~~~~~
- Refactor from pygatt to bleak for async interface
0.4.0 (2020-11-11)
~~~~~~~~~~~~~~~~~~
- Rename discover method to make behavior clear
0.3.1 (2020-11-10)
~~~~~~~~~~~~~~~~~~
- Fix connected status after broken connection
0.3.0 (2020-11-10)
~~~~~~~~~~~~~~~~~~
- Add workaround for firmware bug
0.2.0 (2020-10-14)
~~~~~~~~~~~~~~~~~~
- Remove thread-based auto_reconnect
0.1.1 (2020-10-13)
~~~~~~~~~~~~~~~~~~
- Always raise PykulerskyException
0.1.0 (2020-10-09)
~~~~~~~~~~~~~~~~~~
- Initial release
0.0.1 (2020-10-09)
~~~~~~~~~~~~~~~~~~
- Fork from pyzerproc
Credits
-------
- Thanks to `Uri Shaked`_ for an incredible guide to `Reverse Engineering a Bluetooth Lightbulb`_.
- This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
.. _`Uri Shaked`: https://medium.com/@urish
.. _`Reverse Engineering a Bluetooth Lightbulb`: https://medium.com/@urish/reverse-engineering-a-bluetooth-lightbulb-56580fcb7546
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
Raw data
{
"_id": null,
"home_page": "https://github.com/emlove/pykulersky",
"name": "pykulersky",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "pykulersky",
"author": "Emily Love Mills",
"author_email": "emily@emlove.me",
"download_url": "https://files.pythonhosted.org/packages/1b/58/a5d70d05c2a25a984ba81265098125dd0621e800b479d3831eb4a93a4e29/pykulersky-0.5.5.tar.gz",
"platform": null,
"description": "==========\npykulersky\n==========\n\n\n.. image:: https://img.shields.io/pypi/v/pykulersky.svg\n :target: https://pypi.python.org/pypi/pykulersky\n\n.. image:: https://github.com/emlove/pykulersky/workflows/tests/badge.svg\n :target: https://github.com/emlove/pykulersky/actions\n\n.. image:: https://coveralls.io/repos/emlove/pykulersky/badge.svg\n :target: https://coveralls.io/r/emlove/pykulersky\n\n\nLibrary to control Brightech Kuler Sky Bluetooth LED smart lamps\n\n* Free software: Apache Software License 2.0\n\n\nFeatures\n--------\n\n* Discover nearby bluetooth devices\n* Get light color\n* Set light color\n\n\nCommand line usage\n------------------\npykulersky ships with a command line tool that exposes the features of the library.\n\n.. code-block:: console\n\n $ pykulersky discover\n INFO:pykulersky.discovery:Starting scan for local devices\n INFO:pykulersky.discovery:Discovered AA:BB:CC:00:11:22: Living Room\n INFO:pykulersky.discovery:Discovered AA:BB:CC:33:44:55: Bedroom\n INFO:pykulersky.discovery:Scan complete\n AA:BB:CC:00:11:22: Living Room\n AA:BB:CC:33:44:55: Bedroom\n\n $ pykulersky get-color AA:BB:CC:00:11:22\n INFO:pykulersky.light:Connecting to AA:BB:CC:00:11:22\n INFO:pykulersky.light:Got color of AA:BB:CC:00:11:22: (0, 0, 0, 255)'>\n 000000ff\n\n $ pykulersky set-color AA:BB:CC:00:11:22 ff000000\n INFO:pykulersky.light:Connecting to AA:BB:CC:00:11:22\n INFO:pykulersky.light:Changing color of AA:BB:CC:00:11:22 to #ff000000\n\n $ pykulersky set-color AA:BB:CC:00:11:22 000000ff\n INFO:pykulersky.light:Connecting to AA:BB:CC:00:11:22\n INFO:pykulersky.light:Changing color of AA:BB:CC:00:11:22 to #000000ff\n\n\nUsage\n-----\n\nDiscover nearby bluetooth devices\n\n.. code-block:: python\n\n import asyncio\n import pykulersky\n\n\n async def main():\n lights = await pykulersky.discover(timeout=5)\n\n for light in lights:\n print(\"Address: {} Name: {}\".format(light.address, light.name))\n\n asyncio.get_event_loop().run_until_complete(main())\n\n\nTurn a light on and off\n\n.. code-block:: python\n\n import asyncio\n import pykulersky\n\n\n async def main():\n address = \"AA:BB:CC:00:11:22\"\n\n light = pykulersky.Light(address)\n\n try:\n await light.connect()\n await light.set_color(0, 0, 0, 255)\n\n await asyncio.sleep(5)\n\n await light.set_color(0, 0, 0, 0)\n finally:\n await light.disconnect()\n\n asyncio.get_event_loop().run_until_complete(main())\n\n\nChange the light color\n\n.. code-block:: python\n\n import asyncio\n import pykulersky\n\n\n async def main():\n address = \"AA:BB:CC:00:11:22\"\n\n light = pykulersky.Light(address)\n\n try:\n await light.connect()\n while True:\n await light.set_color(255, 0, 0, 0) # Red\n await asyncio.sleep(1)\n await light.set_color(0, 255, 0, 0) # Green\n await asyncio.sleep(1)\n await light.set_color(0, 0, 0, 255) # White\n await asyncio.sleep(1)\n finally:\n await light.disconnect()\n\n asyncio.get_event_loop().run_until_complete(main())\n\n\nGet the light color\n\n.. code-block:: python\n\n import asyncio\n import pykulersky\n\n\n async def main():\n address = \"AA:BB:CC:00:11:22\"\n\n light = pykulersky.Light(address)\n\n try:\n await light.connect()\n color = await light.get_color()\n print(color)\n finally:\n await light.disconnect()\n\n asyncio.get_event_loop().run_until_complete(main())\n\n\nChangelog\n---------\n0.5.5 (2023-04-07)\n~~~~~~~~~~~~~~~~~~\n- Support CI for bleak 0.20\n\n0.5.4 (2022-05-03)\n~~~~~~~~~~~~~~~~~~\n- Unpin test dependencies\n\n0.5.3 (2021-11-23)\n~~~~~~~~~~~~~~~~~~\n- Support CI for bleak 0.13\n\n0.5.2 (2021-03-04)\n~~~~~~~~~~~~~~~~~~\n- Use built-in asyncmock for Python 3.8+\n\n0.5.1 (2020-12-23)\n~~~~~~~~~~~~~~~~~~\n- Include default timeout on all API calls\n\n0.5.0 (2020-12-19)\n~~~~~~~~~~~~~~~~~~\n- Refactor from pygatt to bleak for async interface\n\n0.4.0 (2020-11-11)\n~~~~~~~~~~~~~~~~~~\n- Rename discover method to make behavior clear\n\n0.3.1 (2020-11-10)\n~~~~~~~~~~~~~~~~~~\n- Fix connected status after broken connection\n\n0.3.0 (2020-11-10)\n~~~~~~~~~~~~~~~~~~\n- Add workaround for firmware bug\n\n0.2.0 (2020-10-14)\n~~~~~~~~~~~~~~~~~~\n- Remove thread-based auto_reconnect\n\n0.1.1 (2020-10-13)\n~~~~~~~~~~~~~~~~~~\n- Always raise PykulerskyException\n\n0.1.0 (2020-10-09)\n~~~~~~~~~~~~~~~~~~\n- Initial release\n\n0.0.1 (2020-10-09)\n~~~~~~~~~~~~~~~~~~\n- Fork from pyzerproc\n\n\nCredits\n-------\n\n- Thanks to `Uri Shaked`_ for an incredible guide to `Reverse Engineering a Bluetooth Lightbulb`_.\n\n- This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _`Uri Shaked`: https://medium.com/@urish\n.. _`Reverse Engineering a Bluetooth Lightbulb`: https://medium.com/@urish/reverse-engineering-a-bluetooth-lightbulb-56580fcb7546\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "Library to control Brightech Kuler Sky Bluetooth LED smart lamps",
"version": "0.5.5",
"split_keywords": [
"pykulersky"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1b58a5d70d05c2a25a984ba81265098125dd0621e800b479d3831eb4a93a4e29",
"md5": "3e059724d949f2ab44e7d743919c3727",
"sha256": "06d00ddc93f91eeb71a10ab86ff10ad225fd71187cc6a32c7d2de9af0f6d1662"
},
"downloads": -1,
"filename": "pykulersky-0.5.5.tar.gz",
"has_sig": false,
"md5_digest": "3e059724d949f2ab44e7d743919c3727",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 9227,
"upload_time": "2023-04-07T17:14:11",
"upload_time_iso_8601": "2023-04-07T17:14:11.532883Z",
"url": "https://files.pythonhosted.org/packages/1b/58/a5d70d05c2a25a984ba81265098125dd0621e800b479d3831eb4a93a4e29/pykulersky-0.5.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-07 17:14:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "emlove",
"github_project": "pykulersky",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "pykulersky"
}