Webgrid

Config Setup example

Control devices via a webinterface

class Config(ConfigObject):

    def config(self):
        config = {}

        # Webgrid
        config["webgrid"] = {}
        config["webgrid"]["layout"] = [
            # Normal Web view
            [
                [1, 5, 8, 12, 33, 23, 0, 26],
                [2, 6, 9, 13, 32, 16, 17, 15],
                [3, 7, 10, 14, 31, 21, 18, 25],
                [4, 29, 11, 30, 34, 20, 19, 24],
            ],
            # Normal Mobile view
            [
                [1, 2, 3, 4],
                [5, 6, 7, 29],
                [8, 9, 10, 11],
                [12, 13, 14, 30],
                [33, 32, 31, 34],
                [16, 17, 15, 23],
                [21, 18, 25, 22],
                [20, 19, 24, 26],
            ],
        ]
        config["webgrid"]["bg_color"] = "#262626"
        config["webgrid"]["fg_color"] = "#444444"


        return config

    def setup(self):
        # Webgrid ---------------------------------------------------------------
        self.webgrid_kitchen_ceiling = EventObject(
            "webgrid",
            "1",
            value="Kitch C #000000 #444444",
            name="self.webgrid_kitchen_ceiling",
        )
        self.webgrid_livingroom_table = EventObject(
            "webgrid",
            "2",
            value="LR table #000000 #444444",
            name="self.webgrid_livingroom_table",
        )
        self.webgrid_livingroom_window = EventObject(
            "webgrid",
            "3",
            value="LR wdw #000000 #444444",
            name="self.webgrid_livingroom_window",
        )


    def process_event(self):
        if self.webgrid_livingroom.event == "true":
            <do_something>

        if <something_event>:
            self.webgrid_livingroom.set("Livingroom ON #80C105")