How to use the wled.models.State.from_dict function in wled

To help you get started, we’ve selected a few wled examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github frenck / python-wled / wled / models.py View on Github external
effects.sort(key=lambda x: x.name)
            self.effects = effects

        if "palettes" in data and data["palettes"]:
            palettes = [
                Palette(palette_id=palette_id, name=palette)
                for palette_id, palette in enumerate(data["palettes"])
            ]
            palettes.sort(key=lambda x: x.name)
            self.palettes = palettes

        if "info" in data and data["info"]:
            self.info = Info.from_dict(data["info"])

        if "state" in data and data["state"]:
            self.state = State.from_dict(data["state"], self.effects, self.palettes)

        return self