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)
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"])
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"])
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"])