Skip to content

Commit

Permalink
feat: add support for the LIFX Ceiling SKY firmware effect
Browse files Browse the repository at this point in the history
Signed-off-by: Avi Miller <[email protected]>
  • Loading branch information
Djelibeybi committed Jun 13, 2024
1 parent da4f634 commit 595c7cc
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion modules/photons_control/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
from photons_canvas.orientation import nearest_orientation
from photons_control.colour import make_hsbks
from photons_control.script import FromGenerator
from photons_messages import LightMessages, TileEffectType, TileMessages
from photons_messages import (
LightMessages,
TileEffectSkyType,
TileEffectType,
TileMessages,
)

log = logging.getLogger(name="photons_control.tiles")

Expand All @@ -15,6 +20,11 @@
for hue in [0, 40, 60, 122, 239, 271, 294]
]

default_sky_palette = [
{"hue": hue, "brightness": 1, "saturation": 1, "kelvin": 3500}
for hue in [0, 36, 60, 120, 250, 280]
]


def tiles_from(state_pkt):
"""
Expand Down Expand Up @@ -51,10 +61,16 @@ def SetTileEffect(effect, power_on=True, power_on_duration=1, reference=None, **
MORPH
A Morph effect
SKY
A sky effect only supported on LIFX Ceiling, running firmware 4.4 or higher
Options include:
* speed
* duration
* skyType
* cloudSaturationMin
* cloudSaturationMax
* palette
Usage looks like:
Expand Down Expand Up @@ -83,6 +99,18 @@ def SetTileEffect(effect, power_on=True, power_on_duration=1, reference=None, **
options["type"] = typ
options["res_required"] = False

if options["type"] is TileEffectType.SKY:
if "skyType" not in options:
options["skyType"] = TileEffectSkyType.CLOUDS
if "speed" not in options:
options["speed"] = 50
if "cloudSaturationMin" not in options:
options["cloudSaturationMin"] = 50
if "cloudSaturationMax" not in options:
options["cloudSaturationMax"] = 180
if "palette" not in options:
options["palette"] = []

if "palette" not in options:
options["palette"] = default_tile_palette

Expand Down Expand Up @@ -194,6 +222,9 @@ class tile_effect(task.Task):
FLAME
A flame effect
SKY
A sky effect
For effects that take in a palette option, you may specify palette as
``[{"hue": 0, "saturation": 1, "brightness": 1, "kelvin": 2500}, ...]``
Expand Down

0 comments on commit 595c7cc

Please sign in to comment.