ctucx.git: mqtt-webui

webui for mqtt, can be used to control/display data in mqtt-topics

commit b3ee2db4447dbfdd1b73486959e01d038754b5d5
parent ea83d448f936f8077b165820f4873f4e8544fa56
Author: Leah (ctucx) <git@ctu.cx>
Date: Thu, 8 Dec 2022 19:14:23 +0100

add example config
1 file changed, 551 insertions(+), 0 deletions(-)
A
config.json
|
551
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/config.json b/config.json
@@ -0,0 +1,551 @@
+{
+  "pages": [
+    {
+      "icon": "favicon-512x512.png",
+      "id": "mainpage",
+      "sections": [
+        {
+          "items": [
+            {
+              "icon": "icons/electric_range.png",
+              "link": "#leah",
+              "title": "Leah's room",
+              "type": "text"
+            },
+            {
+              "icon": "icons/electric_range.png",
+              "link": "#isa",
+              "title": "Isa's room",
+              "type": "text"
+            }
+          ],
+          "title": "Rooms"
+        },
+        {
+          "items": [
+            {
+              "icon": "icons/power_button.png",
+              "title": "Power",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_hallway",
+                "set": "zigbee2mqtt/ikea_lamp_hallway/set"
+              },
+              "transform": {
+                "get": "return (value.state == 'ON') ? true : false",
+                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
+              },
+              "type": "switch"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 254,
+              "sliderMinValue": 0,
+              "sliderStepValue": 1,
+              "title": "Brighness",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_hallway",
+                "set": "zigbee2mqtt/ikea_lamp_hallway/set"
+              },
+              "transform": {
+                "get": "return value.brightness",
+                "set": "return JSON.stringify({brightness: Number(input)})"
+              },
+              "type": "slider"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 454,
+              "sliderMinValue": 250,
+              "sliderStepValue": 1,
+              "title": "Color Temperature",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_hallway",
+                "set": "zigbee2mqtt/ikea_lamp_hallway/set"
+              },
+              "transform": {
+                "get": "return value.color_temp",
+                "set": "return JSON.stringify({color_temp: Number(input)})"
+              },
+              "type": "slider"
+            }
+          ],
+          "title": "Hallway: Ceiling Light"
+        },
+        {
+          "items": [
+            {
+              "icon": "icons/power_button.png",
+              "title": "Power",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_kitchen",
+                "set": "zigbee2mqtt/ikea_lamp_kitchen/set"
+              },
+              "transform": {
+                "get": "return (value.state == 'ON') ? true : false",
+                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
+              },
+              "type": "switch"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 254,
+              "sliderMinValue": 0,
+              "sliderStepValue": 1,
+              "title": "Brighness",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_kitchen",
+                "set": "zigbee2mqtt/ikea_lamp_kitchen/set"
+              },
+              "transform": {
+                "get": "return value.brightness",
+                "set": "return JSON.stringify({brightness: Number(input)})"
+              },
+              "type": "slider"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 454,
+              "sliderMinValue": 250,
+              "sliderStepValue": 1,
+              "title": "Color Temperature",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_kitchen",
+                "set": "zigbee2mqtt/ikea_lamp_kitchen/set"
+              },
+              "transform": {
+                "get": "return value.color_temp",
+                "set": "return JSON.stringify({color_temp: Number(input)})"
+              },
+              "type": "slider"
+            }
+          ],
+          "title": "Kitchen: Ceiling Light"
+        },
+        {
+          "items": [
+            {
+              "icon": "icons/power_button.png",
+              "title": "Power",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_bathroom",
+                "set": "zigbee2mqtt/ikea_lamp_bathroom/set"
+              },
+              "transform": {
+                "get": "return (value.state == 'ON') ? true : false",
+                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
+              },
+              "type": "switch"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 254,
+              "sliderMinValue": 0,
+              "sliderStepValue": 1,
+              "title": "Brighness",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_bathroom",
+                "set": "zigbee2mqtt/ikea_lamp_bathroom/set"
+              },
+              "transform": {
+                "get": "return value.brightness",
+                "set": "return JSON.stringify({brightness: Number(input)})"
+              },
+              "type": "slider"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 454,
+              "sliderMinValue": 250,
+              "sliderStepValue": 1,
+              "title": "Color Temperature",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_bathroom",
+                "set": "zigbee2mqtt/ikea_lamp_bathroom/set"
+              },
+              "transform": {
+                "get": "return value.color_temp",
+                "set": "return JSON.stringify({color_temp: Number(input)})"
+              },
+              "type": "slider"
+            }
+          ],
+          "title": "Bathroom: Ceiling Light"
+        }
+      ],
+      "title": "Smart-Home"
+    },
+    {
+      "icon": "favicon-512x512.png",
+      "id": "leah",
+      "sections": [
+        {
+          "items": [
+            {
+              "icon": "icons/power_button.png",
+              "title": "Power",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_l",
+                "set": "zigbee2mqtt/ikea_lamp_l/set"
+              },
+              "transform": {
+                "get": "return (value.state == 'ON') ? true : false",
+                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
+              },
+              "type": "switch"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 254,
+              "sliderMinValue": 0,
+              "sliderStepValue": 1,
+              "title": "Brighness",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_l",
+                "set": "zigbee2mqtt/ikea_lamp_l/set"
+              },
+              "transform": {
+                "get": "return value.brightness",
+                "set": "return JSON.stringify({brightness: Number(input)})"
+              },
+              "type": "slider"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 454,
+              "sliderMinValue": 250,
+              "sliderStepValue": 1,
+              "title": "Color Temperature",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_l",
+                "set": "zigbee2mqtt/ikea_lamp_l/set"
+              },
+              "transform": {
+                "get": "return value.color_temp",
+                "set": "return JSON.stringify({color_temp: Number(input)})"
+              },
+              "type": "slider"
+            }
+          ],
+          "title": "Ceiling Light"
+        },
+        {
+          "items": [
+            {
+              "icon": "icons/power_button.png",
+              "title": "Power",
+              "topic": {
+                "get": "zigbee2mqtt/led_stripe_desk",
+                "set": "zigbee2mqtt/led_stripe_desk/set"
+              },
+              "transform": {
+                "get": "return (value.state == 'ON') ? true : false",
+                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
+              },
+              "type": "switch"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 254,
+              "sliderMinValue": 0,
+              "sliderStepValue": 1,
+              "title": "Brighness",
+              "topic": {
+                "get": "zigbee2mqtt/led_stripe_desk",
+                "set": "zigbee2mqtt/led_stripe_desk/set"
+              },
+              "transform": {
+                "get": "return value.brightness",
+                "set": "return JSON.stringify({brightness: Number(input)})"
+              },
+              "type": "slider"
+            }
+          ],
+          "title": "Desk"
+        },
+        {
+          "items": [
+            {
+              "icon": "icons/power_button.png",
+              "title": "Power",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_l_rgb",
+                "set": "zigbee2mqtt/ikea_lamp_l_rgb/set"
+              },
+              "transform": {
+                "get": "return (value.state == 'ON') ? true : false",
+                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
+              },
+              "type": "switch"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 254,
+              "sliderMinValue": 0,
+              "sliderStepValue": 1,
+              "title": "Brighness",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_l_rgb",
+                "set": "zigbee2mqtt/ikea_lamp_l_rgb/set"
+              },
+              "transform": {
+                "get": "return value.brightness",
+                "set": "return JSON.stringify({brightness: Number(input)})"
+              },
+              "type": "slider"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 454,
+              "sliderMinValue": 250,
+              "sliderStepValue": 1,
+              "title": "Color Temperature",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_l_rgb",
+                "set": "zigbee2mqtt/ikea_lamp_l_rgb/set"
+              },
+              "transform": {
+                "get": "return value.color_temp",
+                "set": "return JSON.stringify({color_temp: Number(input)})"
+              },
+              "type": "slider"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "selectOptions": [
+                {
+                  "label": "Red",
+                  "value": "0.71,0.26"
+                },
+                {
+                  "label": "Green",
+                  "value": "0.19,0.78"
+                },
+                {
+                  "label": "Blue",
+                  "value": "0.09,0.13"
+                }
+              ],
+              "title": "Color",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_l_rgb",
+                "set": "zigbee2mqtt/ikea_lamp_l_rgb/set"
+              },
+              "transform": {
+                "get": "return value.color.x + ','+value.color.y",
+                "set": "return JSON.stringify({color: {x: input.split(',')[0], y: input.split(',')[1]}})"
+              },
+              "type": "select"
+            }
+          ],
+          "title": "RGB Lamp"
+        },
+        {
+          "items": [
+            {
+              "icon": "icons/power.png",
+              "title": "Voltage",
+              "topic": "sdm2mqtt/leah",
+              "transform": "return Math.round((value.voltage + Number.EPSILON) * 100) / 100 + ' V'",
+              "type": "text"
+            },
+            {
+              "icon": "icons/power.png",
+              "title": "Power",
+              "topic": "sdm2mqtt/leah",
+              "transform": "return Math.round((value.power + Number.EPSILON) * 100) / 100 + ' W'",
+              "type": "text"
+            },
+            {
+              "icon": "icons/power.png",
+              "title": "Frequency",
+              "topic": "sdm2mqtt/leah",
+              "transform": "return value.frequency + ' Hz'",
+              "type": "text"
+            },
+            {
+              "icon": "icons/power.png",
+              "title": "cos φ",
+              "topic": "sdm2mqtt/leah",
+              "transform": "return Math.round((value.cosphi + Number.EPSILON) * 100) / 100",
+              "type": "text"
+            },
+            {
+              "icon": "icons/power.png",
+              "title": "Total Import",
+              "topic": "sdm2mqtt/leah",
+              "transform": "return Math.round((value.import + Number.EPSILON) * 100) / 100 + ' kWh'",
+              "type": "text"
+            }
+          ],
+          "title": "Power-Meter"
+        }
+      ],
+      "title": "Leah's room"
+    },
+    {
+      "icon": "favicon-512x512.png",
+      "id": "isa",
+      "sections": [
+        {
+          "items": [
+            {
+              "icon": "icons/power_button.png",
+              "title": "Power",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_i",
+                "set": "zigbee2mqtt/ikea_lamp_i/set"
+              },
+              "transform": {
+                "get": "return (value.state == 'ON') ? true : false",
+                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
+              },
+              "type": "switch"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 254,
+              "sliderMinValue": 0,
+              "sliderStepValue": 1,
+              "title": "Brighness",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_i",
+                "set": "zigbee2mqtt/ikea_lamp_i/set"
+              },
+              "transform": {
+                "get": "return value.brightness",
+                "set": "return JSON.stringify({brightness: Number(input)})"
+              },
+              "type": "slider"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 454,
+              "sliderMinValue": 250,
+              "sliderStepValue": 1,
+              "title": "Color Temperature",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_i",
+                "set": "zigbee2mqtt/ikea_lamp_i/set"
+              },
+              "transform": {
+                "get": "return value.color_temp",
+                "set": "return JSON.stringify({color_temp: Number(input)})"
+              },
+              "type": "slider"
+            }
+          ],
+          "title": "Ceiling Light"
+        },
+        {
+          "items": [
+            {
+              "icon": "icons/power_button.png",
+              "title": "Power",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_i_rgb",
+                "set": "zigbee2mqtt/ikea_lamp_i_rgb/set"
+              },
+              "transform": {
+                "get": "return (value.state == 'ON') ? true : false",
+                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
+              },
+              "type": "switch"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 254,
+              "sliderMinValue": 0,
+              "sliderStepValue": 1,
+              "title": "Brighness",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_i_rgb",
+                "set": "zigbee2mqtt/ikea_lamp_i_rgb/set"
+              },
+              "transform": {
+                "get": "return value.brightness",
+                "set": "return JSON.stringify({brightness: Number(input)})"
+              },
+              "type": "slider"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "sliderMaxValue": 454,
+              "sliderMinValue": 250,
+              "sliderStepValue": 1,
+              "title": "Color Temperature",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_i_rgb",
+                "set": "zigbee2mqtt/ikea_lamp_i_rgb/set"
+              },
+              "transform": {
+                "get": "return value.color_temp",
+                "set": "return JSON.stringify({color_temp: Number(input)})"
+              },
+              "type": "slider"
+            },
+            {
+              "icon": "icons/bulb.png",
+              "selectOptions": [
+                {
+                  "label": "Red",
+                  "value": "0.71,0.26"
+                },
+                {
+                  "label": "Green",
+                  "value": "0.19,0.78"
+                },
+                {
+                  "label": "Blue",
+                  "value": "0.09,0.13"
+                }
+              ],
+              "title": "Color",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_lamp_i_rgb",
+                "set": "zigbee2mqtt/ikea_lamp_i_rgb/set"
+              },
+              "transform": {
+                "get": "return value.color.x + ','+value.color.y",
+                "set": "return JSON.stringify({color: {x: input.split(',')[0], y: input.split(',')[1]}})"
+              },
+              "type": "select"
+            }
+          ],
+          "title": "RGB Lamp"
+        },
+        {
+          "items": [
+            {
+              "icon": "icons/power_button.png",
+              "title": "Desk (L)",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_control_outlet_i_desk_l",
+                "set": "zigbee2mqtt/ikea_control_outlet_i_desk_l/set"
+              },
+              "transform": {
+                "get": "return (value.state == 'ON') ? true : false",
+                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
+              },
+              "type": "switch"
+            },
+            {
+              "icon": "icons/power_button.png",
+              "title": "Desk (R)",
+              "topic": {
+                "get": "zigbee2mqtt/ikea_control_outlet_i_desk_r",
+                "set": "zigbee2mqtt/ikea_control_outlet_i_desk_r/set"
+              },
+              "transform": {
+                "get": "return (value.state == 'ON') ? true : false",
+                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
+              },
+              "type": "switch"
+            }
+          ],
+          "title": "Power-Meter"
+        }
+      ],
+      "title": "Isa's room"
+    }
+  ]
+}