diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-lightwave.spec | 330 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 332 insertions, 0 deletions
@@ -0,0 +1 @@ +/lightwave-0.24.tar.gz diff --git a/python-lightwave.spec b/python-lightwave.spec new file mode 100644 index 0000000..98209b2 --- /dev/null +++ b/python-lightwave.spec @@ -0,0 +1,330 @@ +%global _empty_manifest_terminate_build 0 +Name: python-lightwave +Version: 0.24 +Release: 1 +Summary: Python library to provide a reliable communication link with LightWaveRF lights, switches and TRVs. +License: MIT +URL: https://github.com/GeoffAtHome/lightwave +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/96/1a/7754f0a3639b3c8c7c05310de7ba67af3bf1e36a20537bde0473bbc91793/lightwave-0.24.tar.gz +BuildArch: noarch + + +%description +# 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) + + +%package -n python3-lightwave +Summary: Python library to provide a reliable communication link with LightWaveRF lights, switches and TRVs. +Provides: python-lightwave +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-lightwave +# 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) + + +%package help +Summary: Development documents and examples for lightwave +Provides: python3-lightwave-doc +%description help +# 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) + + +%prep +%autosetup -n lightwave-0.24 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-lightwave -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.24-1 +- Package Spec generated @@ -0,0 +1 @@ +2b76b6af4f1be8dd08513860fef39ad9 lightwave-0.24.tar.gz |
