Skip to content

Instantly share code, notes, and snippets.

@delfick
Created Jan 21, 2019
Embed
What would you like to do?
from photons_app.executor import library_setup
from photons_messages import DeviceMessages
from photons_colour import Parser
collector = library_setup()
lan_target = collector.configuration['target_register'].resolve("lan")
async def doit():
on_msg = DeviceMessages.SetPower(level=65535, res_required=False)
first_brightness = Parser.color_to_msg("brightness:1", overrides={"duration": 0, "res_required": False})
blink = Parser.color_to_msg("brightness:0"
, overrides = {
"effect": "sine"
, "cycles": 15
, "period": 1
, "skew_ratio": 0.5
, "res_required": False
}
)
script = lan_target.script([first_brightness, on_msg, blink])
# You'd of course get the serial from the commandline
# and/or use a special reference:
# https://delfick.github.io/photons-core/photons_app/special.html#photons-app-special
await script.run_with_all("d073d5229322")
loop = collector.configuration["photons_app"].loop
loop.run_until_complete(doit())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment