async def apply_theme(collector, target, reference, artifact, **kwargs): """ Apply a theme to specified device ``lan:apply_theme d073d5000001 -- `{"colors": [<color>, <color>, ...], "theme": "SPLOTCH", "overrides": {<hsbk dictionary>}}'`` If you don't specify serials, then the theme will apply to all devices found on the network. Colors may be words like "red", "blue", etc. Or may be [h, s, b, k] arrays where each part is optional. theme must be a valid theme type and defaults to SPLOTCH You may also specify ``duration`` which is how long to take to apply in seconds. And you may also supply ``overrides`` with ``hue``, ``saturation``, ``brightness`` and ``kelvin`` to override the specified colors. """ extra = collector.photons_app.extra_as_json everything = {} if "overrides" in extra: everything["overrides"] = extra["overrides"] if "colors" not in extra: extra["colors"] = default_colors options = Options.FieldSpec().normalise(Meta(everything, []), extra) def errors(e): log.error(e) await target.send(ApplyTheme.script(options), reference, error_catcher=errors)
def assertProperties(self, thing, checker): checker(thing) bts = thing.pack() thing2 = type(thing).unpack(bts) checker(thing2) thing3 = type(thing).normalise(Meta.empty(), json.loads(repr(thing))) checker(thing3)