bt-lamp


Namebt-lamp JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/LVettel/bt_lamp
SummaryControll bluetooth lamp from python
upload_time2023-10-16 20:39:15
maintainer
docs_urlNone
authorLVettel
requires_python>=3.9
license
keywords bluetooth python lamp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## bt-lamp
This is a python lib for control your Bluetooth Low Energy (BLE) lamp.

## Features
The lib offers the following functionality:
- Turning the lamp on / off
- Controlling lamp brightness
- Controlling lamp temperature
- Sending initial setup signal

## Lamp compatibility
bt-lamp should work with at least some lamps (that are non-RGB, dimmable, cool/warm only) that use the following app

- [LampSmart Pro](https://play.google.com/store/apps/details?id=com.jingyuan.lamp)

Lamps tested to work include

- Natali Kovaltseva with BT support

### OS

Lib tested on raspberry 2. Lib need sudo permissions

### Hardware
Your bluetooth card needs to support at least Bluetooth v4.0 LE and have working drivers / firmware for Linux.

Working cards (not exhaustive):

 - Intel AC-8265
 - Broadcom BCM20702A0, see https://github.com/winterheart/broadcom-bt-firmware
 - Qualcomm Atheros QCA9377
 - Realtek RTL8761BU (most "cheap" eBay USB BT dongles) via `firmware-realtek` package
 - TP-Link UB500 Adapter
   

## Usage

You van use lib from command line or import as module. To install the module, run:

    pip install bt_lamp

### Comand line syntax
sudo -E env PATH=$PATH python -m bt_lamp command name [level] [log-level]

Available command:
 - setup           connect to the lamp
 - on              turn the lamp on
 - off             turn the lamp off
 - cold  <1..10>    set cold brightness
 - warm  <1..10>    set warm brightness
 - dual  <1..10>    set dual brightness

 level - lamp brightness, number between 1 and 10

### Using as module

```
from bt_lamp import BtLamp

lamp = BtLamp("MY_LAMP")

# setup
lamp.setup()

# on
lamp.on()

# off
lamp.off()

# cold
lamp.cold(5)

# warm
lamp.warm(5)

# dual
lamp.dual(5)

```

### Initial setup
Before you can control your lamp, you have to perform an initial setup so the lamp will remember a unique name that you specify.

To setup more than one lamp, setup each lamp individually by assigning a new name to each lamp.

To perform the initial setup:
- Think up of a name. In this example we will use LAMP0.
- Turn the lamp on using the power switch
- Within a few seconds after powering the lamp on, send a setup signal from your device:

```
sudo -E env PATH=$PATH python -m bt_lamp setup LAMP0
```
  
- If you see the lamp flashing, the connection is established

To reiterate **sudo permissions are required to access the ble stack on modern linux**

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/LVettel/bt_lamp",
    "name": "bt-lamp",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "bluetooth python lamp",
    "author": "LVettel",
    "author_email": "larin230@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/df/03/e13c06ab1992b048e875ea2b76b1c9b20f16e8c6d31b4480f5d6289ae963/bt_lamp-1.0.7.tar.gz",
    "platform": null,
    "description": "## bt-lamp\r\nThis is a python lib for control your Bluetooth Low Energy (BLE) lamp.\r\n\r\n## Features\r\nThe lib offers the following functionality:\r\n- Turning the lamp on / off\r\n- Controlling lamp brightness\r\n- Controlling lamp temperature\r\n- Sending initial setup signal\r\n\r\n## Lamp compatibility\r\nbt-lamp should work with at least some lamps (that are non-RGB, dimmable, cool/warm only) that use the following app\r\n\r\n- [LampSmart Pro](https://play.google.com/store/apps/details?id=com.jingyuan.lamp)\r\n\r\nLamps tested to work include\r\n\r\n- Natali Kovaltseva with BT support\r\n\r\n### OS\r\n\r\nLib tested on raspberry 2. Lib need sudo permissions\r\n\r\n### Hardware\r\nYour bluetooth card needs to support at least Bluetooth v4.0 LE and have working drivers / firmware for Linux.\r\n\r\nWorking cards (not exhaustive):\r\n\r\n - Intel AC-8265\r\n - Broadcom BCM20702A0, see https://github.com/winterheart/broadcom-bt-firmware\r\n - Qualcomm Atheros QCA9377\r\n - Realtek RTL8761BU (most \"cheap\" eBay USB BT dongles) via `firmware-realtek` package\r\n - TP-Link UB500 Adapter\r\n   \r\n\r\n## Usage\r\n\r\nYou van use lib from command line or import as module. To install the module, run:\r\n\r\n    pip install bt_lamp\r\n\r\n### Comand line syntax\r\nsudo -E env PATH=$PATH python -m bt_lamp command name [level] [log-level]\r\n\r\nAvailable command:\r\n - setup           connect to the lamp\r\n - on              turn the lamp on\r\n - off             turn the lamp off\r\n - cold  <1..10>    set cold brightness\r\n - warm  <1..10>    set warm brightness\r\n - dual  <1..10>    set dual brightness\r\n\r\n level - lamp brightness, number between 1 and 10\r\n\r\n### Using as module\r\n\r\n```\r\nfrom bt_lamp import BtLamp\r\n\r\nlamp = BtLamp(\"MY_LAMP\")\r\n\r\n# setup\r\nlamp.setup()\r\n\r\n# on\r\nlamp.on()\r\n\r\n# off\r\nlamp.off()\r\n\r\n# cold\r\nlamp.cold(5)\r\n\r\n# warm\r\nlamp.warm(5)\r\n\r\n# dual\r\nlamp.dual(5)\r\n\r\n```\r\n\r\n### Initial setup\r\nBefore you can control your lamp, you have to perform an initial setup so the lamp will remember a unique name that you specify.\r\n\r\nTo setup more than one lamp, setup each lamp individually by assigning a new name to each lamp.\r\n\r\nTo perform the initial setup:\r\n- Think up of a name. In this example we will use LAMP0.\r\n- Turn the lamp on using the power switch\r\n- Within a few seconds after powering the lamp on, send a setup signal from your device:\r\n\r\n```\r\nsudo -E env PATH=$PATH python -m bt_lamp setup LAMP0\r\n```\r\n  \r\n- If you see the lamp flashing, the connection is established\r\n\r\nTo reiterate **sudo permissions are required to access the ble stack on modern linux**\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Controll bluetooth lamp from python",
    "version": "1.0.7",
    "project_urls": {
        "Documentation": "https://github.com/LVettel/bt_lamp",
        "Homepage": "https://github.com/LVettel/bt_lamp"
    },
    "split_keywords": [
        "bluetooth",
        "python",
        "lamp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b40e1f9a34fada312e7cd5e2dcfec98fd0fc6b329eecb10a2d16b386916f3db4",
                "md5": "43de6a5395753157d9d49e6529c20b98",
                "sha256": "c1cd5bd9f43702ec93452206c749f75c79dcd04ec3ead676d6a5e829ad264b4f"
            },
            "downloads": -1,
            "filename": "bt_lamp-1.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "43de6a5395753157d9d49e6529c20b98",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 7654,
            "upload_time": "2023-10-16T20:39:13",
            "upload_time_iso_8601": "2023-10-16T20:39:13.858542Z",
            "url": "https://files.pythonhosted.org/packages/b4/0e/1f9a34fada312e7cd5e2dcfec98fd0fc6b329eecb10a2d16b386916f3db4/bt_lamp-1.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df03e13c06ab1992b048e875ea2b76b1c9b20f16e8c6d31b4480f5d6289ae963",
                "md5": "55adf0d793efcc0bcbed4f8bc805c8a8",
                "sha256": "a968d65c9cb3ed2e3ed612a2193be8a7a829a9def415a4b23091caeeb4b93cde"
            },
            "downloads": -1,
            "filename": "bt_lamp-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "55adf0d793efcc0bcbed4f8bc805c8a8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 7221,
            "upload_time": "2023-10-16T20:39:15",
            "upload_time_iso_8601": "2023-10-16T20:39:15.295750Z",
            "url": "https://files.pythonhosted.org/packages/df/03/e13c06ab1992b048e875ea2b76b1c9b20f16e8c6d31b4480f5d6289ae963/bt_lamp-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-16 20:39:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LVettel",
    "github_project": "bt_lamp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "bt-lamp"
}
        
Elapsed time: 0.19128s