ctucx.git: mqtt-webui

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

commit d5de508664c81a64b1412dbb6f23379215e60191
parent 6aad7bc7def7b24a1b05761bf204cb46620e3253
Author: Leah (ctucx) <git@ctu.cx>
Date: Mon, 12 Dec 2022 23:15:04 +0100

better example config
3 files changed, 114 insertions(+), 608 deletions(-)
M
config.json
|
512
++++++++-----------------------------------------------------------------------
M
config.nix
|
209
++++++++++++++++++++++++++-----------------------------------------------------
M
flake.nix
|
1
+
diff --git a/config.json b/config.json
@@ -1,4 +1,5 @@
 {
+  "disableAuth": false,
   "pages": [
     {
       "icon": "favicon-512x512.png",

@@ -8,200 +9,18 @@
           "items": [
             {
               "icon": "icons/electric_range.png",
-              "link": "#leah",
-              "title": "Leah's room",
+              "link": "#page1",
+              "title": "Click me!",
               "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 (message.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 message.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 message.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 (message.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 message.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 message.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 (message.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 message.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 message.color_temp",
-                "set": "return JSON.stringify({color_temp: Number(input)})"
-              },
-              "type": "slider"
             }
           ],
-          "title": "Bathroom: Ceiling Light"
+          "title": "Sub-Pages"
         },
         {
           "items": [
             {
-              "icon": "icons/temperature.png",
-              "title": "Fridge",
-              "topic": "lacrosse2mqtt/33",
-              "transform": "return Math.round((message.temperature + Number.EPSILON) * 100) / 100 + ' °C'",
-              "type": "text"
-            },
-            {
-              "icon": "icons/temperature.png",
-              "title": "Bathroom",
-              "topic": "lacrosse2mqtt/5",
-              "transform": "return Math.round((message.temperature + Number.EPSILON) * 100) / 100 + ' °C - ' + message.humidity + ' %'",
-              "type": "text"
-            }
-          ],
-          "title": "Temperature-Sensors"
-        }
-      ],
-      "title": "Smart-Home"
-    },
-    {
-      "icon": "favicon-512x512.png",
-      "id": "leah",
-      "sections": [
-        {
-          "items": [
-            {
               "icon": "icons/power_button.png",
-              "title": "Power",
+              "title": "Switch",
               "topic": {
                 "get": "zigbee2mqtt/ikea_lamp_l",
                 "set": "zigbee2mqtt/ikea_lamp_l/set"

@@ -217,7 +36,7 @@
               "sliderMaxValue": 254,
               "sliderMinValue": 0,
               "sliderStepValue": 1,
-              "title": "Brighness",
+              "title": "Slider",
               "topic": {
                 "get": "zigbee2mqtt/ikea_lamp_l",
                 "set": "zigbee2mqtt/ikea_lamp_l/set"

@@ -230,103 +49,42 @@
             },
             {
               "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 message.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 (message.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 message.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 (message.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",
+              "title": "Number",
               "topic": {
-                "get": "zigbee2mqtt/ikea_lamp_l_rgb",
-                "set": "zigbee2mqtt/ikea_lamp_l_rgb/set"
+                "get": "zigbee2mqtt/ikea_lamp_l",
+                "set": "zigbee2mqtt/ikea_lamp_l/set"
               },
               "transform": {
                 "get": "return message.brightness",
                 "set": "return JSON.stringify({brightness: Number(input)})"
               },
-              "type": "slider"
+              "type": "number"
             },
             {
+              "buttons": [
+                {
+                  "label": "On",
+                  "value": "ON"
+                },
+                {
+                  "label": "Off",
+                  "value": "OFF"
+                }
+              ],
               "icon": "icons/bulb.png",
-              "sliderMaxValue": 454,
-              "sliderMinValue": 250,
-              "sliderStepValue": 1,
-              "title": "Color Temperature",
+              "title": "Buttons",
               "topic": {
                 "get": "zigbee2mqtt/ikea_lamp_l_rgb",
                 "set": "zigbee2mqtt/ikea_lamp_l_rgb/set"
               },
               "transform": {
-                "get": "return message.color_temp",
-                "set": "return JSON.stringify({color_temp: Number(input)})"
+                "get": "return message.state;",
+                "set": "return JSON.stringify({state: input});"
               },
-              "type": "slider"
+              "type": "button"
             },
             {
               "icon": "icons/bulb.png",

@@ -344,7 +102,7 @@
                   "value": "0.09,0.13"
                 }
               ],
-              "title": "Color",
+              "title": "Select",
               "topic": {
                 "get": "zigbee2mqtt/ikea_lamp_l_rgb",
                 "set": "zigbee2mqtt/ikea_lamp_l_rgb/set"

@@ -354,10 +112,28 @@
                 "set": "return JSON.stringify({color: {x: input.split(',')[0], y: input.split(',')[1]}})"
               },
               "type": "select"
+            },
+            {
+              "icon": "icons/temperature.png",
+              "title": "Text",
+              "topic": "lacrosse2mqtt/5",
+              "transform": "return Math.round((message.temperature + Number.EPSILON) * 100) / 100 + ' °C - ' + message.humidity + ' %'",
+              "type": "text"
+            },
+            {
+              "html": "this is html! <b>bold</b> <u>underline</u><h1>H1</h1>",
+              "type": "html"
             }
           ],
-          "title": "RGB Lamp"
-        },
+          "title": "Available Elements:"
+        }
+      ],
+      "title": "Some Title"
+    },
+    {
+      "icon": "favicon-512x512.png",
+      "id": "page1",
+      "sections": [
         {
           "items": [
             {

@@ -397,205 +173,9 @@
             }
           ],
           "title": "Power-Meter"
-        },
-        {
-          "items": [
-            {
-              "icon": "icons/temperature.png",
-              "title": "Temperature",
-              "topic": "lacrosse2mqtt/3a",
-              "transform": "return Math.round((message.temperature + Number.EPSILON) * 100) / 100 + ' °C'",
-              "type": "text"
-            }
-          ],
-          "title": "Temperature-Sensors"
-        }
-      ],
-      "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 (message.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 message.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 message.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 (message.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 message.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 message.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 message.color.x + ','+message.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 (message.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 (message.state == 'ON') ? true : false",
-                "set": "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})"
-              },
-              "type": "switch"
-            }
-          ],
-          "title": "Switches"
-        },
-        {
-          "items": [
-            {
-              "icon": "icons/temperature.png",
-              "title": "Temperature",
-              "topic": "lacrosse2mqtt/3c",
-              "transform": "return Math.round((message.temperature + Number.EPSILON) * 100) / 100 + ' °C'",
-              "type": "text"
-            },
-            {
-              "icon": "icons/thermostat.png",
-              "title": "Humidity",
-              "topic": "lacrosse2mqtt/3c",
-              "transform": "return message.humidity + ' %'",
-              "type": "text"
-            }
-          ],
-          "title": "Temperature-Sensors"
         }
       ],
-      "title": "Isa's room"
+      "title": "I'm a sub-page!"
     }
   ]
 }
diff --git a/config.nix b/config.nix
@@ -10,7 +10,7 @@ let
     transform.set = "return JSON.stringify({state: (input) ? 'ON' : 'OFF'})";
   };
 
-  BrighnessSlider = name: topic: {
+  Slider = name: topic: {
     title           = name;
     type            = "slider";
     icon            = "icons/bulb.png";

@@ -23,135 +23,113 @@ let
     transform.set   = "return JSON.stringify({brightness: Number(input)})";
   };
 
-  ColorTemperatureSlider = name: topic: {
+  Number = name: topic: {
     title           = name;
-    type            = "slider";
+    type            = "number";
     icon            = "icons/bulb.png";
-    sliderMinValue  = 250;
-    sliderMaxValue  = 454;
+    sliderMinValue  = 0;
+    sliderMaxValue  = 254;
     sliderStepValue = 1;
     topic.get       = topic;
     topic.set       = "${topic}/set";
-    transform.get   = "return message.color_temp";
-    transform.set   = "return JSON.stringify({color_temp: Number(input)})";
-  };
-
-  DimmableLamp = name: topic: {
-    title = name;
-    items = [
-      (Switch          "Power"     topic)
-      (BrighnessSlider "Brighness" topic)
-    ];
-  };
-
-  WhiteSpectrumLamp = name: topic: {
-    title = name;
-    items = [
-      (Switch                 "Power"             topic)
-      (BrighnessSlider        "Brighness"         topic)
-      (ColorTemperatureSlider "Color Temperature" topic)
-    ];
-  };
-
-  ColorSpectrumLamp = name: topic: {
-    title = name;
-    items = [
-      (Switch                 "Power"             topic)
-      (BrighnessSlider        "Brighness"         topic)
-      (ColorTemperatureSlider "Color Temperature" topic)
-
-      {
-        title           = "Color";
-        type            = "select";
-        icon            = "icons/bulb.png";
-        topic.get       = topic;
-        topic.set       = "${topic}/set";
-        transform.get   = "return message.color.x + ','+message.color.y";
-        transform.set   = "return JSON.stringify({color: {x: input.split(',')[0], y: input.split(',')[1]}})";
-        selectOptions   = [
-          {
-            label = "Red";
-            value = "0.71,0.26";
-          }
-          {
-            label = "Green";
-            value = "0.19,0.78";
-          }
-          {
-            label = "Blue";
-            value = "0.09,0.13";
-          }
-        ];
-      }
-    ];
+    transform.get   = "return message.brightness";
+    transform.set   = "return JSON.stringify({brightness: Number(input)})";
   };
 
-
 in {
 
+  disableAuth = false;
   pages =  [
     {
       id        = "mainpage";
       icon     = "favicon-512x512.png";
-      title    = "Smart-Home";
+      title    = "Some Title";
       sections = [
         {
-          title = "Rooms";
+          title = "Sub-Pages";
           items = [
             {
-              title = "Leah's room";
-              type = "text";
-              icon = "icons/electric_range.png";
-              link = "#leah";
-            }
-            {
-              title = "Isa's room";
+              title = "Click me!";
               type = "text";
               icon = "icons/electric_range.png";
-              link = "#isa";
+              link = "#page1";
             }
           ];
         }
 
-        (WhiteSpectrumLamp "Hallway: Ceiling Light" "zigbee2mqtt/ikea_lamp_hallway")
-
-        (WhiteSpectrumLamp "Kitchen: Ceiling Light" "zigbee2mqtt/ikea_lamp_kitchen")
-
-        (WhiteSpectrumLamp "Bathroom: Ceiling Light" "zigbee2mqtt/ikea_lamp_bathroom")
-
        {
-          title = "Temperature-Sensors";
+          title = "Available Elements:";
           items = [
+            (Switch "Switch" "zigbee2mqtt/ikea_lamp_l")
+            (Slider "Slider" "zigbee2mqtt/ikea_lamp_l")
+            (Number "Number" "zigbee2mqtt/ikea_lamp_l")
+
             {
-              title     = "Fridge";
-              type      = "text";
-              topic     = "lacrosse2mqtt/33";
-              icon      = "icons/temperature.png";
-              transform = "return Math.round((message.temperature + Number.EPSILON) * 100) / 100 + ' °C'";
+              title         = "Buttons";
+              type          = "button";
+              icon          = "icons/bulb.png";
+              buttons       = [
+                {
+                  label = "On";
+                  value = "ON";
+                }
+                {
+                  label = "Off";
+                  value = "OFF";
+                }
+              ];
+              topic.get     = "zigbee2mqtt/ikea_lamp_l_rgb";
+              topic.set     = "zigbee2mqtt/ikea_lamp_l_rgb/set";
+              transform.get = "return message.state;";
+              transform.set = "return JSON.stringify({state: input});";
             }
+
             {
-              title     = "Bathroom";
+              title           = "Select";
+              type            = "select";
+              icon            = "icons/bulb.png";
+              topic.get       = "zigbee2mqtt/ikea_lamp_l_rgb";
+              topic.set       = "zigbee2mqtt/ikea_lamp_l_rgb/set";
+              transform.get   = "return message.color.x + ','+message.color.y";
+              transform.set   = "return JSON.stringify({color: {x: input.split(',')[0], y: input.split(',')[1]}})";
+              selectOptions   = [
+                {
+                  label = "Red";
+                  value = "0.71,0.26";
+                }
+                {
+                  label = "Green";
+                  value = "0.19,0.78";
+                }
+                {
+                  label = "Blue";
+                  value = "0.09,0.13";
+                }
+              ];
+            }
+
+            {
+              title     = "Text";
               type      = "text";
               topic     = "lacrosse2mqtt/5";
               icon      = "icons/temperature.png";
               transform = "return Math.round((message.temperature + Number.EPSILON) * 100) / 100 + ' °C - ' + message.humidity + ' %'";
             }
+
+            {
+              type = "html";
+              html = "this is html! <b>bold</b> <u>underline</u><h1>H1</h1>";
+            }
           ];
         }
       ];
     }
 
     {
-      id       = "leah";
+      id       = "page1";
       icon     = "favicon-512x512.png";
-      title    = "Leah's room";
+      title    = "I'm a sub-page!";
       sections = [
-        (WhiteSpectrumLamp "Ceiling Light" "zigbee2mqtt/ikea_lamp_l")
-
-        (DimmableLamp "Desk" "zigbee2mqtt/led_stripe_desk")
-
-        (ColorSpectrumLamp "RGB Lamp" "zigbee2mqtt/ikea_lamp_l_rgb")
-
         {
           title = "Power-Meter";
           items = [

@@ -192,59 +170,6 @@ in {
             }
           ];
         }
-
-        {
-          title = "Temperature-Sensors";
-          items = [
-            {
-              title     = "Temperature";
-              type      = "text";
-              topic     = "lacrosse2mqtt/3a";
-              icon      = "icons/temperature.png";
-              transform = "return Math.round((message.temperature + Number.EPSILON) * 100) / 100 + ' °C'";
-            }
-          ];
-        }
-      ];
-    }
-
-    {
-      id       = "isa";
-      icon     = "favicon-512x512.png";
-      title    = "Isa's room";
-      sections = [
-        (WhiteSpectrumLamp "Ceiling Light" "zigbee2mqtt/ikea_lamp_i")
-
-        (ColorSpectrumLamp "RGB Lamp" "zigbee2mqtt/ikea_lamp_i_rgb")
-
-        {
-          title = "Switches";
-          items = [
-            (Switch "Desk (L)" "zigbee2mqtt/ikea_control_outlet_i_desk_l")
-            (Switch "Desk (R)" "zigbee2mqtt/ikea_control_outlet_i_desk_r")
-          ];
-        }
-
-        {
-          title = "Temperature-Sensors";
-          items = [
-            {
-              title     = "Temperature";
-              type      = "text";
-              topic     = "lacrosse2mqtt/3c";
-              icon      = "icons/temperature.png";
-              transform = "return Math.round((message.temperature + Number.EPSILON) * 100) / 100 + ' °C'";
-            }
-            {
-              title     = "Humidity";
-              type      = "text";
-              topic     = "lacrosse2mqtt/3c";
-              icon      = "icons/thermostat.png";
-              transform = "return message.humidity + ' %'";
-            }
-          ];
-        }
-
       ];
     }
 
diff --git a/flake.nix b/flake.nix
@@ -49,6 +49,7 @@
         shellHook = ''
           export NODE_OPTIONS=--openssl-legacy-provider
           alias serve="yarn build && caddy run"
+          alias generate-config="nix-instantiate --eval -E 'builtins.toJSON(import ./config.nix)' | jq '. | fromjson' > config.json"
         '';
       };