Skip to content

Commit

Permalink
docs: update new API to doc, add major changlog
Browse files Browse the repository at this point in the history
  • Loading branch information
FengChendian committed Apr 16, 2024
1 parent 2777895 commit 23106ac
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,20 @@ grouped_lights = hue.grouped_lights

for group in grouped_lights:
print(group.type)
group.on = True
# group.on = True
group.set_state(True, 100, None) # Feature in
group.set_state(on_state_value=True, brightness=100, duration_ms=1)

```

## Low Level Control

Also, you can use basic function in bridge class.
> Low level function may be changed when update
You can use some basic functions in this library.

For example, you can use `get_lights`,`set_light` or other low level control functions to implement
some custom functions.

```python
import time
Expand All @@ -137,6 +145,8 @@ bridge.get_zones()

Some API may be de deprecated When major version updates.

- Grouped light API will be changed after version `2.0.0`

## TODO

- Zones Control Class
2 changes: 1 addition & 1 deletion src/python_hue_v2/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.3'
__version__ = '2.0.0'
11 changes: 9 additions & 2 deletions src/python_hue_v2/grouped_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class GroupedLight:
"""API to manage grouped light service, just one group
Only supports HTTP PUT and GET method.
"""

def __init__(self, bridge: Bridge, grouped_light_id: str):
self.bridge = bridge
self.grouped_light_id: str = grouped_light_id
Expand Down Expand Up @@ -50,8 +51,14 @@ def on(self) -> bool:
def on(self, value: bool):
self._set({'on': {'on': value}})

def set_state(self, value: bool, brightness: float = None, duration_ms: int = None):
properties = {'on': {'on': value}}
def set_state(self, on_state_value: bool, brightness: float = None, duration_ms: int = None):
"""
Set the state of the grouped light
:param on_state_value: Boolean value to change the state of the grouped light
:param brightness: Group light brightness value
:param duration_ms: duration in dynamics
"""
properties = {'on': {'on': on_state_value}}
if duration_ms:
properties['dynamics'] = {'duration': duration_ms}
if brightness:
Expand Down

0 comments on commit 23106ac

Please sign in to comment.