# lightwave
Python library to provide a reliable communication link with LightWaveRF lights, switches and TRVs.
# Installation
Either clone this repository and run `python setup.py install`, or install from pip using `pip install lightwave`.
## API
This library makes use of the public API provided by lightwave that can be found here: https://api.lightwaverf.com/lighting_power.html
# Lights and Switches
The library supports the following functions:
```
turn_on_light(device_id, name)
turn_on_switch(device_id, name)
turn_on_with_brightness(device_id, name, brightness)
turn_off(device_id, name)
```
Where:
* **device_id** takes the form **R#D#** where **R#** is the room number and **D#** is the device number.
* **name** is the text that will be displayed on the hub.
* **brightness** is a value from 0 (off) to 255 (full on).
## Usage
Initialise a link to the hub by passing in the IP address required. Then call a method on the object to modify the device.
The first time a switch is turned on or off the device will attempt to pair to the hub. This should then show a message on your WiFi Link asking you to pair the device. You have 12 seconds to push the button on the WiFi Link to accept this.
```
import asyncio
import time
from lightwave.lightwave import LWLink
async def main():
lwLink = LWLink('192.168.15.226')
print("Off")
### R1D3 is room 1 device 3
lwLink.turn_off('R1D3', "Wall Lights")
lwLink.turn_off('R1D4', "Ceiling Lights")
time.sleep(5)
print("On")
lwLink.turn_on_light('R1D3', "Wall Lights")
lwLink.turn_on_light('R1D4', "Ceiling Lights")
time.sleep(5)
print("Off")
lwLink.turn_off('R1D3', "Wall Lights")
lwLink.turn_off('R1D4', "Ceiling Lights")
time.sleep(5)
print("On")
lwLink.turn_on_with_brightness('R1D3', "Wall Lights", 25)
lwLink.turn_on_with_brightness('R1D4', "Ceiling Lights", 50)
lwLink.turn_on_switch('R1D1', "Sockets one")
lwLink.turn_on_switch('R1D2', "Sockets two")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
```
# TRV Support
The library also supports TRVs with the following function:
```
set_temperature (device_id, temp, name)
```
Where:
* **device_id** takes the form **R#D#** where **R#** is the room number and **D#** is the device identifier (normally **Dh**).
* **temp** is the target temperature (0.5 increments)
* **name** is the text that will be displayed on the hub.
## TRV Proxy
The Proxy is now optional. A built in listener is now available via the async function ```LW_listen()```.
Alternativly, to read the TRV status (current temperature, target_temperature, battery status and current output) a [Lightwave TRV Proxy](https://github.com/ColinRobbins/Homeassistant-Lightwave-TRV) can be used.
To use the proxy:
```
set_trv_proxy (proxy_ip, proxy_port)
(temp, targ, batt, output) = read_trv_status(serial)
```
Where:
* **proxy_ip** is the IP address of the proxy
* **proxy_port** is the IP Port of the proxy
* **serial** is the serial number of the TRV of interest (NB: This is the **serial** number, and NOT **device_id** they are different).
# Contributors
* TRV Support by [Colin Robbins](https://github.com/ColinRobbins)
Raw data
{
"_id": null,
"home_page": "https://github.com/GeoffAtHome/lightwave",
"name": "lightwave",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Lightwave,LightwaveRF,Lightwave WiFiLink,Lightwave Link",
"author": "Geoff Soord",
"author_email": "geoff@soord.org.uk",
"download_url": "https://files.pythonhosted.org/packages/96/1a/7754f0a3639b3c8c7c05310de7ba67af3bf1e36a20537bde0473bbc91793/lightwave-0.24.tar.gz",
"platform": null,
"description": "# lightwave\nPython library to provide a reliable communication link with LightWaveRF lights, switches and TRVs.\n\n# Installation\nEither clone this repository and run `python setup.py install`, or install from pip using `pip install lightwave`.\n\n## API\nThis library makes use of the public API provided by lightwave that can be found here: https://api.lightwaverf.com/lighting_power.html\n# Lights and Switches\nThe library supports the following functions:\n```\nturn_on_light(device_id, name)\nturn_on_switch(device_id, name)\nturn_on_with_brightness(device_id, name, brightness)\nturn_off(device_id, name)\n```\nWhere:\n* **device_id** takes the form **R#D#** where **R#** is the room number and **D#** is the device number.\n* **name** is the text that will be displayed on the hub.\n* **brightness** is a value from 0 (off) to 255 (full on).\n\n## Usage\nInitialise a link to the hub by passing in the IP address required. Then call a method on the object to modify the device.\nThe first time a switch is turned on or off the device will attempt to pair to the hub. This should then show a message on your WiFi Link asking you to pair the device. You have 12 seconds to push the button on the WiFi Link to accept this.\n\n\n```\nimport asyncio\nimport time\nfrom lightwave.lightwave import LWLink\n\nasync def main():\n lwLink = LWLink('192.168.15.226')\n\n print(\"Off\")\n ### R1D3 is room 1 device 3\n lwLink.turn_off('R1D3', \"Wall Lights\")\n lwLink.turn_off('R1D4', \"Ceiling Lights\")\n\n time.sleep(5)\n print(\"On\")\n lwLink.turn_on_light('R1D3', \"Wall Lights\")\n lwLink.turn_on_light('R1D4', \"Ceiling Lights\")\n\n time.sleep(5)\n print(\"Off\")\n lwLink.turn_off('R1D3', \"Wall Lights\")\n lwLink.turn_off('R1D4', \"Ceiling Lights\")\n\n\n time.sleep(5)\n print(\"On\")\n lwLink.turn_on_with_brightness('R1D3', \"Wall Lights\", 25)\n lwLink.turn_on_with_brightness('R1D4', \"Ceiling Lights\", 50)\n lwLink.turn_on_switch('R1D1', \"Sockets one\")\n lwLink.turn_on_switch('R1D2', \"Sockets two\")\n\n\nloop = asyncio.get_event_loop()\nloop.run_until_complete(main())\nloop.close()\n```\n# TRV Support\nThe library also supports TRVs with the following function:\n```\nset_temperature (device_id, temp, name)\n```\nWhere:\n* **device_id** takes the form **R#D#** where **R#** is the room number and **D#** is the device identifier (normally **Dh**).\n* **temp** is the target temperature (0.5 increments)\n* **name** is the text that will be displayed on the hub.\n## TRV Proxy\nThe Proxy is now optional. A built in listener is now available via the async function ```LW_listen()```.\n\nAlternativly, to read the TRV status (current temperature, target_temperature, battery status and current output) a [Lightwave TRV Proxy](https://github.com/ColinRobbins/Homeassistant-Lightwave-TRV) can be used. \nTo use the proxy:\n```\nset_trv_proxy (proxy_ip, proxy_port)\n(temp, targ, batt, output) = read_trv_status(serial)\n```\nWhere:\n* **proxy_ip** is the IP address of the proxy\n* **proxy_port** is the IP Port of the proxy\n* **serial** is the serial number of the TRV of interest (NB: This is the **serial** number, and NOT **device_id** they are different).\n# Contributors\n* TRV Support by [Colin Robbins](https://github.com/ColinRobbins)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python library to provide a reliable communication link with LightWaveRF lights, switches and TRVs.",
"version": "0.24",
"project_urls": {
"Homepage": "https://github.com/GeoffAtHome/lightwave"
},
"split_keywords": [
"lightwave",
"lightwaverf",
"lightwave wifilink",
"lightwave link"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "93fe0a3276b6f33af4263a973eeebf1850a74aab4ba0426f0c43c349b0112df6",
"md5": "4356e0036f79f12dbb5e38bfc2e18bfd",
"sha256": "ed8634bf6477cd68cf66de3ab4405838490b5216f674a02cf450532e965f30b1"
},
"downloads": -1,
"filename": "lightwave-0.24-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4356e0036f79f12dbb5e38bfc2e18bfd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6005,
"upload_time": "2023-05-08T10:41:55",
"upload_time_iso_8601": "2023-05-08T10:41:55.527544Z",
"url": "https://files.pythonhosted.org/packages/93/fe/0a3276b6f33af4263a973eeebf1850a74aab4ba0426f0c43c349b0112df6/lightwave-0.24-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "961a7754f0a3639b3c8c7c05310de7ba67af3bf1e36a20537bde0473bbc91793",
"md5": "2b76b6af4f1be8dd08513860fef39ad9",
"sha256": "97d8707402aba5d5e3fe992b8328ae85b3da1a04fab637e83b0fd306947e9352"
},
"downloads": -1,
"filename": "lightwave-0.24.tar.gz",
"has_sig": false,
"md5_digest": "2b76b6af4f1be8dd08513860fef39ad9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5855,
"upload_time": "2023-05-08T10:41:58",
"upload_time_iso_8601": "2023-05-08T10:41:58.232203Z",
"url": "https://files.pythonhosted.org/packages/96/1a/7754f0a3639b3c8c7c05310de7ba67af3bf1e36a20537bde0473bbc91793/lightwave-0.24.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-08 10:41:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "GeoffAtHome",
"github_project": "lightwave",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "lightwave"
}