From a14b675a01180b914b35693a067f453c1816518b Mon Sep 17 00:00:00 2001 From: Stavros Korokithakis Date: Tue, 15 Nov 2016 14:05:57 +0200 Subject: [PATCH] feat: Add presets. --- yeecli/cli.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/yeecli/cli.py b/yeecli/cli.py index 9f53fa4..608b88d 100644 --- a/yeecli/cli.py +++ b/yeecli/cli.py @@ -170,7 +170,12 @@ def turn(state): bulb.turn_off() -@cli.command() +@cli.group() +def preset(): + """Various presets.""" + + +@preset.command() def disco(): """Party!""" click.echo("Party mode: activated.") @@ -190,6 +195,32 @@ def disco(): bulb.start_flow(flow) +@preset.command() +def strobe(): + """Epilepsy warning.""" + click.echo("Strobing.") + transitions = [ + yeelight.flow.HSVTransition(0, 0, duration=50, brightness=100), + yeelight.flow.HSVTransition(0, 0, duration=50, brightness=1), + ] + flow = yeelight.Flow(count=0, transitions=transitions) + for bulb in BULBS: + bulb.start_flow(flow) + + +@preset.command() +def temp(): + """Slowly-changing color temperature.""" + click.echo("Enjoy.") + transitions = [ + yeelight.flow.TemperatureTransition(1700, duration=40000), + yeelight.flow.TemperatureTransition(6500, duration=40000), + ] + flow = yeelight.Flow(count=0, transitions=transitions) + for bulb in BULBS: + bulb.start_flow(flow) + + @cli.command() def save(): """Save the current settings as default."""