Esempio n. 1
0
def h(parent, bp):
    room = parent

    for _, child_path, old, new in bp:
        typ, attr = util.typ_attr_from_child_path(child_path)

        if typ == ul_gvr and attr == "power":
            put(path="control.power.intent", src=new, target=room)
Esempio n. 2
0
def h(lp, ul, typ):
    lp = first_attr("spec", lp)

    assert typ in converters, typ

    put(f"control.power.status", lp, ul,
        transform=converters[typ]["power"]["from"])

    put(f"control.brightness.status", lp, ul,
        transform=converters[typ]["brightness"]["from"])
Esempio n. 3
0
def h(parent, bp):
    ul = parent

    for _, child_path, old, new in bp:
        typ, attr = util.typ_attr_from_child_path(child_path)

        assert typ in converters, typ

        # back-prop logic
        put(path=f"control.{attr}.intent",
            src=new, target=ul,
            transform=converters[typ][attr]["from"])
Esempio n. 4
0
def h(parent, child):
    ul, lp = parent, first_attr("spec", child)
    if lp is None:
        return

    typ = first_type(child)
    assert typ in converters, typ

    put(f"control.power.intent", ul, lp,
        transform=converters[typ]["power"]["to"])

    put(f"control.brightness.intent", ul, lp,
        transform=converters[typ]["brightness"]["to"])