Skip to content

Instantly share code, notes, and snippets.

@delfick
Created January 21, 2019 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save delfick/0147de1cdc9a625bbb9d5b967e2b9840 to your computer and use it in GitHub Desktop.
Save delfick/0147de1cdc9a625bbb9d5b967e2b9840 to your computer and use it in GitHub Desktop.
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