Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def sunrise(duration):
"""Simulate sunrise in seconds (default 5min)."""
click.echo("Good morning!")
# We're using seconds for duration because it's a more natural timescale
# for this preset.
duration = duration * 1000
transitions = [
# First set to minimum temperature, low brightness, nearly immediately.
tr.TemperatureTransition(1700, duration=50, brightness=1),
# Then slowly transition to higher temperature, max brightness.
# 5000 is about regular daylight white.
tr.TemperatureTransition(2100, duration=duration / 2, brightness=50),
tr.TemperatureTransition(5000, duration=duration / 2, brightness=100),
]
flow = yeelight.Flow(count=1, action=yeelight.flow.Action.stay, transitions=transitions)
for bulb in BULBS:
bulb.start_flow(flow)
def sunrise(duration):
"""Simulate sunrise in seconds (default 5min)."""
click.echo("Good morning!")
# We're using seconds for duration because it's a more natural timescale
# for this preset.
duration = duration * 1000
transitions = [
# First set to minimum temperature, low brightness, nearly immediately.
tr.TemperatureTransition(1700, duration=50, brightness=1),
# Then slowly transition to higher temperature, max brightness.
# 5000 is about regular daylight white.
tr.TemperatureTransition(2100, duration=duration / 2, brightness=50),
tr.TemperatureTransition(5000, duration=duration / 2, brightness=100),
]
flow = yeelight.Flow(count=1, action=yeelight.flow.Action.stay, transitions=transitions)
for bulb in BULBS:
bulb.start_flow(flow)
def sunrise(duration):
"""Simulate sunrise in seconds (default 5min)."""
click.echo("Good morning!")
# We're using seconds for duration because it's a more natural timescale
# for this preset.
duration = duration * 1000
transitions = [
# First set to minimum temperature, low brightness, nearly immediately.
tr.TemperatureTransition(1700, duration=50, brightness=1),
# Then slowly transition to higher temperature, max brightness.
# 5000 is about regular daylight white.
tr.TemperatureTransition(2100, duration=duration / 2, brightness=50),
tr.TemperatureTransition(5000, duration=duration / 2, brightness=100),
]
flow = yeelight.Flow(count=1, action=yeelight.flow.Action.stay, transitions=transitions)
for bulb in BULBS:
bulb.start_flow(flow)