Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/happyleavesaoc/python-limitlessled
https://github.com/happyleavesaoc/python-limitlessled
limitlessled milight python3
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/happyleavesaoc/python-limitlessled
- Owner: happyleavesaoc
- License: mit
- Created: 2015-11-04T20:56:00.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-09-09T21:12:14.000Z (over 3 years ago)
- Last Synced: 2024-12-06T21:26:57.108Z (16 days ago)
- Topics: limitlessled, milight, python3
- Language: Python
- Size: 103 KB
- Stars: 32
- Watchers: 16
- Forks: 22
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/happyleavesaoc/python-limitlessled.svg?branch=master)](https://travis-ci.org/happyleavesaoc/python-limitlessled) [![PyPI version](https://badge.fury.io/py/limitlessled.svg)](https://badge.fury.io/py/limitlessled)
# python-limitlessled
`python-limitlessled` controls LimitlessLED bridges. It supports `white`, `rgbw` and `rgbww` bulb groups as well as the `bridge-led` of newer wifi bridges.
## Install
`pip install limitlessled`## Usage
### Configure
Your bridge(s) must be set up and bulbs joined prior to using this module.Group names can be any string, but must be unique amongst all bridges.
```python
from limitlessled.bridge import Bridge
from limitlessled.group.rgbw import RGBW
from limitlessled.group.rgbww import RGBWW
from limitlessled.group.white import WHITEbridge = Bridge('')
bridge.add_group(1, 'bedroom', RGBW)
# A group number can support two groups as long as the types differ
bridge.add_group(2, 'bathroom', WHITE)
bridge.add_group(2, 'living_room', RGBW)
bridge.add_group(2, 'kitchen', RGBWW)
```Get access to groups either via the return value of `add_group`, or with the `LimitlessLED` object.
```python
bedroom = bridge.add_group(1, 'bedroom', RGBW)
# or
limitlessled = LimitlessLED()
limitlessled.add_bridge(bridge)
bedroom = limitlessled.group('bedroom')# The bridge led can be controlled and acts as a RGBW group
bridge_led = bridge.bridge_led
```### Control
Turn on:
```python
bedroom.on = True
```Change brightness:
```python
bedroom.brightness = 0.5 # 0.0 through 1.0
```Change temperature (white groups only)
```python
bedroom.temperature = 0.5 # 0.0 through 1.0
```Change color (rgbw groups only)
LimitlessLED RGBW bulbs can represent only the hue component of RGB color. There are 256 possible values, starting with blue as 0. Maximum saturation and value are always used. This means that most RGB colors are not supported. There are two special cases: Black (0, 0, 0) is simply all LEDs turned off. White (255, 255, 255) is the RGB LEDs off and the white LED on. Note that the actual color of the white LED depends on whether the bulb is a cool white or a warm white bulb.
```python
from limitlessled import Color
bedroom.color = Color(255, 0, 0) # red
```Transition
```python
bedroom.transition(brightness=1.0, temperature=0.1) # white groupsfrom limitlessled import Color
bedroom.transition(brightness=1.0, color=Color(0, 255, 0)) # rgbw groups
```#### Pipelines
Pipelines specify a sequence of stages, each stage being a command. Pipelines are not executed until called as an argument to a group's `enqueue` method.
Pipelines are executed in a thread (per group). Multiple pipelines can be started on a group; they will queue and execute in the order received.
A bridge can run multiple pipelines concurrently provided they are on different groups. Note that concurrency is achieved by interleaving commands, and as a consequence, pipeline execution can take longer than specified and each pipeline may use fewer transition steps depending on the number of concurrently executing pipelines.
```python
from limitlessled import Color
from limitlessled.pipeline import Pipelinepipeline = Pipeline() \
.on() \
.brightness(0.7) \
.color(0, 0, 255) \
.transition(color=Color(255, 0, 0))
bedroom.enqueue(pipeline)
```Stop the currently-running pipeline:
```python
bedroom.stop()
```##### Commands
Turn on
```python
Pipeline().on()
```Turn off
```python
Pipeline().off()
```Set brightness
```python
Pipeline().brightness(0.5)
```Set temperature
```python
Pipeline().temperature(0.5)
```Set color
```python
Pipeline().color(255, 0, 0)
```Transition
```python
Pipeline().transition(...)
```Wait
```python
Pipeline.().wait(4) # in seconds
```Repeat
`stages` is how many previous stages to repeat
`iterations` is how many times to repeat stagesDefault `stages` is `1`, default `iterations` is infinite.
```python
Pipeline().repeat(stages=2, iterations=3)
```
Callback
```python
def my_function():
passPipeline().callback(my_function)
```Append
```python
p1 = Pipeline.off()p2 = Pipeline.on().append(p1)
```## Contributions
Pull requests welcome. Some areas for enhancement include
- Discovery
- Pairing## Disclaimer
Not affiliated with LimitlessLED and/or marketers/manufacturers of rebranded devices.