Пример #1
0
def main(argv=None):
    setup_logging()

    parser = make_parser()
    args = parser.parse_args(argv)

    if not os.path.exists(args.src):
        raise Exception(
            "Couldn't find the source yaml file, did you `git submodule update --init` ?"
        )

    with open(args.src) as fle:
        src = YAML(typ="safe").load(fle)
    adjustments = YAML(typ="safe").load(args.adjustments)

    if not os.path.exists(args.output_folder):
        os.makedirs(args.output_folder)

    try:
        generate(src, adjustments, args.output_folder)
    except DelfickError as error:
        print("")
        print("!" * 20)
        sys.exit(str(error))
Пример #2
0
#!/usr/bin/python -ci=__import__;o=i("os");s=i("sys");a=s.argv;p=o.path;y=p.join(p.dirname(a[1]),".python");o.execv(y,a)

from photons_app.executor import library_setup
from photons_app.special import FoundSerials

from photons_messages import LightMessages

from delfick_project.logging import setup_logging
import logging


async def doit(collector):
    lan_target = collector.resolve_target("lan")

    msg = LightMessages.GetColor()
    async for pkt in lan_target.send(msg, FoundSerials()):
        hsbk = " ".join("{0}={1}".format(key, pkt.payload[key])
                        for key in ("hue", "saturation", "brightness",
                                    "kelvin"))
        print("{0}: {1}".format(pkt.serial, hsbk))


if __name__ == "__main__":
    setup_logging(level=logging.ERROR)
    collector = library_setup()
    collector.run_coro_as_main(doit(collector))
Пример #3
0
    ]
    color_msgs = [
        ColourParser.msg(
            name,
            overrides={
                "res_required": False,
                "duration": spread,
                "brightness": args.brightness,
            },
        ) for name in color_names
    ]
    colors = Pipeline(*color_msgs, spread=spread, synchronized=True)

    pipeline = Pipeline(power_on,
                        Repeater(colors, min_loop_time=len(color_names)),
                        synchronized=True)

    def e(error):
        log.error(error)

    await lan_target.send(pipeline,
                          reference,
                          message_timeout=1,
                          error_catcher=e)


if __name__ == "__main__":
    setup_logging()
    collector = library_setup()
    collector.run_coro_as_main(doit(collector))