ctucx.git: nixfiles

ctucx' nixfiles

commit b2e65231cc839ed4683e2c6810d816a705d966f9
parent 0e69584de0e742720bb7da9ba0e0123a7fd1b43e
Author: Leah (ctucx) <git@ctu.cx>
Date: Tue, 9 May 2023 13:43:09 +0200

machines/lollo: add `solar-nrw`
18 files changed, 869 insertions(+), 16 deletions(-)
M
flake.lock
|
25
+++++++++++++++++++++++++
M
flake.nix
|
9
+++++++++
M
machines/lollo/configuration.nix
|
1
+
M
machines/lollo/smarthome/mosquitto.nix
|
6
++++++
A
machines/lollo/smarthome/mqtt-webui/extra-css/manifest.json
|
14
++++++++++++++
M
machines/lollo/smarthome/telegraf.nix
|
15
+++++++++------
A
machines/lollo/solar-nrw/default.nix
|
13
+++++++++++++
A
machines/lollo/solar-nrw/mqtt-webui/config.nix
|
534
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
machines/lollo/solar-nrw/mqtt-webui/default.nix
|
41
+++++++++++++++++++++++++++++++++++++++++
A
machines/lollo/solar-nrw/mqtt-webui/extra-files/manifest.json
|
13
+++++++++++++
A
machines/lollo/solar-nrw/solax2mqtt.nix
|
56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
machines/lollo/solar-nrw/telegraf.nix
|
32
++++++++++++++++++++++++++++++++
A
machines/lollo/solar-nrw/vpn.nix
|
58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
secrets/lollo/mosquitto/passwd-nrw.age
|
11
+++++++++++
A
secrets/lollo/solar-nrw/solax2mqtt.age
|
15
+++++++++++++++
A
secrets/lollo/solar-nrw/vpn-secrets.age
|
13
+++++++++++++
M
secrets/lollo/telegraf_env.age
|
25
+++++++++++++++----------
M
secrets/secrets.nix
|
4
++++
diff --git a/flake.lock b/flake.lock
@@ -596,6 +596,7 @@
         "oeffisearch": "oeffisearch",
         "sdm2mqtt": "sdm2mqtt",
         "simple-nixos-mailserver": "simple-nixos-mailserver",
+        "solax2mqtt": "solax2mqtt",
         "stagit": "stagit"
       }
     },

@@ -647,6 +648,30 @@
         "type": "gitlab"
       }
     },
+    "solax2mqtt": {
+      "inputs": {
+        "flake-utils": [
+          "flake-utils"
+        ],
+        "nixpkgs": [
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1683273476,
+        "narHash": "sha256-U2DuvKNJ1TitMe64ZDzn2/rGSW7sQRNI1OyWHOSzX4Q=",
+        "ref": "main",
+        "rev": "d0a51f7b0976ec683a6c4e022c56110f74189b58",
+        "revCount": 1,
+        "type": "git",
+        "url": "https://git.ctu.cx/solax2mqtt"
+      },
+      "original": {
+        "ref": "main",
+        "type": "git",
+        "url": "https://git.ctu.cx/solax2mqtt"
+      }
+    },
     "stable": {
       "locked": {
         "lastModified": 1669735802,
diff --git a/flake.nix b/flake.nix
@@ -19,6 +19,7 @@
       inputs.mobile-coverage-map.overlay
 
       inputs.sdm2mqtt.overlay
+      inputs.solax2mqtt.overlay
       inputs.lacrosse2mqtt.overlay
       inputs.departures2mqtt.overlay
       inputs.mqtt-webui.overlay

@@ -169,6 +170,14 @@
       inputs.flake-utils.follows = "flake-utils";
     };
 
+    solax2mqtt = {
+      type  = "git";
+      url   = "https://git.ctu.cx/solax2mqtt";
+      ref   = "main";
+      inputs.nixpkgs.follows     = "nixpkgs";
+      inputs.flake-utils.follows = "flake-utils";
+    };
+
     lacrosse2mqtt = {
       type  = "git";
       url   = "https://git.ctu.cx/lacrosse2mqtt";
diff --git a/machines/lollo/configuration.nix b/machines/lollo/configuration.nix
@@ -24,6 +24,7 @@
     ./syncthing.nix
 
     ./smarthome
+    ./solar-nrw
     ./websites
   ];
 
diff --git a/machines/lollo/smarthome/mosquitto.nix b/machines/lollo/smarthome/mosquitto.nix
@@ -7,6 +7,11 @@
       file  = ../../../secrets/lollo/mosquitto/passwd-leah.age;
       owner = "mosquitto";
     };
+
+    mosquitto-passwd-nrw = {
+      file  = ../../../secrets/lollo/mosquitto/passwd-nrw.age;
+      owner = "mosquitto";
+    };
   };
 
   services = {

@@ -30,6 +35,7 @@
           port = 9005;
           users = {
             leah.passwordFile = config.age.secrets.mosquitto-passwd-leah.path;
+            nrw.passwordFile  = config.age.secrets.mosquitto-passwd-nrw.path;
           };
           settings = {
             protocol = "websockets";
diff --git a/machines/lollo/smarthome/mqtt-webui/extra-css/manifest.json b/machines/lollo/smarthome/mqtt-webui/extra-css/manifest.json
@@ -0,0 +1,13 @@
+{
+	"name": "Smart-Home",
+	"short_name": "Smart-Home",
+	"start_url": ".",
+	"display": "standalone",
+	"icons": [
+		{
+			"src": "favicon-512x512.png",
+			"sizes": "512x512",
+			"type": "image/png"
+		}
+	]
+}+
\ No newline at end of file
diff --git a/machines/lollo/smarthome/telegraf.nix b/machines/lollo/smarthome/telegraf.nix
@@ -27,12 +27,15 @@
         };
       };
       outputs = {
-        influxdb_v2 = {
-          urls         = [ "https://influx.home.ctu.cx" ];
-          organization = "leah";
-          bucket       = "mqttData";
-          token        = "\${INFLUX_TOKEN}";
-        };
+        influxdb_v2 = [
+          {
+            urls         = [ "https://influx.home.ctu.cx" ];
+            organization = "leah";
+            bucket       = "mqttData";
+            token        = "\${INFLUX_TOKEN_MQTTDATA}";
+            tagdrop.topic = [ "solax2mqtt" ];
+          }
+        ];
       };
     };
   };
diff --git a/machines/lollo/solar-nrw/default.nix b/machines/lollo/solar-nrw/default.nix
@@ -0,0 +1,12 @@
+{ inputs, lib, pkgs, config, ... }:
+
+{
+
+  imports = [
+    ./solax2mqtt.nix
+    ./telegraf.nix
+
+    ./mqtt-webui
+  ];
+
+}+
\ No newline at end of file
diff --git a/machines/lollo/solar-nrw/mqtt-webui/config.nix b/machines/lollo/solar-nrw/mqtt-webui/config.nix
@@ -0,0 +1,533 @@
+{
+
+  appName     = "Solar System NRW";
+  disableAuth = false;
+  pages =  [
+    {
+      id        = "mainpage";
+      icon     = "favicon-512x512.png";
+      title    = "Übersicht";
+      sections = [
+        {
+          title = "PV";
+          items = [
+            {
+              title     = "PV1 Leistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_pv1_power + ' W'";
+            }
+            {
+              title     = "PV2 Leistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_pv2_power + ' W'";
+            }
+            {
+              title     = "PV Gesamtleistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_pv_power + ' W'";
+            }
+            {
+              title = "Mehr Informationen";
+              type = "text";
+              icon = "icons/electric_range.png";
+              link = "#pv";
+            }
+          ];
+        }
+        {
+          title = "Wechselrichter";
+          items = [
+            {
+              title     = "Leistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_power + ' W'";
+            }
+            {
+              title     = "Einspeisung/Bezug";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_grid_in_power + ' W'";
+            }
+            {
+              title     = "Gesamtleistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_power_total + ' W'";
+            }
+
+            {
+              title = "Mehr Informationen";
+              type = "text";
+              icon = "icons/electric_range.png";
+              link = "#inverter";
+            }
+          ];
+        }
+        {
+          title = "Batterie";
+          items = [
+            {
+              title     = "Akkustand";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_soc + ' %'";
+            }
+            {
+              title     = "Leistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_power + ' W'";
+            }
+
+            {
+              title = "Mehr Informationen";
+              type = "text";
+              icon = "icons/electric_range.png";
+              link = "#battery";
+            }
+
+          ];
+        }
+
+        {
+          title = "Status";
+          items = [
+            {
+              title     = "Letzte Aktualisierung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "let date =  new Date(message.last_update*1000); return date.toLocaleTimeString() + ', '+ date.toLocaleDateString();";
+            }
+
+          ];
+        }
+
+      ];
+    }
+
+    {
+      id       = "pv";
+      icon     = "favicon-512x512.png";
+      title    = "PV Details";
+      sections = [
+        {
+          title = "PV1 ()";
+          items = [
+            {
+              title     = "Spannung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_pv1_voltage + ' V'";
+            }
+            {
+              title     = "Strom";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_pv1_current + ' A'";
+            }
+            {
+              title     = "Leistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_pv1_power + ' W'";
+            }
+          ];
+        }
+        {
+          title = "PV2 ()";
+          items = [
+            {
+              title     = "Spannung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_pv2_voltage + ' V'";
+            }
+            {
+              title     = "Strom";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_pv2_current + ' A'";
+            }
+            {
+              title     = "Leistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_pv2_power + ' W'";
+            }
+          ];
+        }
+      ];
+    }
+
+    {
+      id       = "inverter";
+      icon     = "favicon-512x512.png";
+      title    = "Wechselrichter Details";
+      sections = [
+
+        {
+          title = "Verbrauch";
+          items = [
+
+            {
+              title     = "Leistung Wechselrichter";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_power + ' W'";
+            }
+
+            {
+              title     = "Einspeisung/Bezug";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_grid_in_power + ' W'";
+            }
+
+            {
+              title     = "Gesamtleistung (inkl. Bezug)";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_power_total + ' W'";
+            }
+
+            {
+              title     = "Bezug (heute)";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_grid_out_energy_today + ' kWh'";
+            }
+
+            {
+              title     = "Gesamtverbrauch";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_energy_total + ' kWh'";
+            }
+
+          ];
+        }
+
+        {
+          title = "Ertrag";
+          items = [
+            {
+              title     = "Tagesertrag";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_yield_energy_today + ' kWh'";
+            }
+
+            {
+              title     = "Gesamtertrag";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_yield_energy_total + ' kWh'";
+            }
+
+            {
+              title     = "Einspeisung (heute)";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_grid_in_energy_today + ' kWh'";
+            }
+
+            {
+              title     = "Einspeisung (gesamt)";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_grid_in_energy_total + ' kWh'";
+            }
+
+          ];
+        }
+
+        {
+          title = "L1";
+          items = [
+            {
+              title     = "Spannung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l1_voltage + ' V'";
+            }
+            {
+              title     = "Strom";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l1_current + ' A'";
+            }
+            {
+              title     = "Leistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l1_power + ' W'";
+            }
+            {
+              title     = "Frequenz";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l1_frequency + ' Hz'";
+            }
+          ];
+        }
+
+        {
+          title = "L2";
+          items = [
+            {
+              title     = "Spannung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l2_voltage + ' V'";
+            }
+            {
+              title     = "Strom";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l2_current + ' A'";
+            }
+            {
+              title     = "Leistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l2_power + ' W'";
+            }
+            {
+              title     = "Frequenz";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l2_frequency + ' Hz'";
+            }
+          ];
+        }
+
+        {
+          title = "L3";
+          items = [
+            {
+              title     = "Spannung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l3_voltage + ' V'";
+            }
+            {
+              title     = "Strom";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l3_current + ' A'";
+            }
+            {
+              title     = "Leistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l3_power + ' W'";
+            }
+            {
+              title     = "Frequenz";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_l3_frequency + ' Hz'";
+            }
+          ];
+        }
+
+        {
+          title = "System Informationen";
+          items = [
+            {
+              title     = "Modell";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_model";
+            }
+
+            {
+              title     = "Firmware Version";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_firmware_version";
+            }
+
+            {
+              title     = "Registrierungsnummer";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_registration_number";
+            }
+
+            {
+              title     = "Seriennummer";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_serial_number";
+            }
+
+            {
+              title     = "Betriebsmodus";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.inverter_mode";
+            }
+
+          ];
+        }
+
+      ];
+    }
+
+    {
+      id       = "battery";
+      icon     = "favicon-512x512.png";
+      title    = "Batterie Details";
+      sections = [
+        {
+          title = "Details";
+          items = [
+            {
+              title     = "Modus";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_mode";
+            }
+
+            {
+              title     = "Status";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_status";
+            }
+
+            {
+              title     = "Temperatur";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_temperature + ' °C'";
+            }
+
+            {
+              title     = "Akkustand";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_soc + ' %'";
+            }
+
+            {
+              title     = "Gespeicherte Energie";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_remaining_capacity + ' kWh'";
+            }
+
+            {
+              title     = "Geladen (heute)";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_charge_today + ' kWh'";
+            }
+
+            {
+              title     = "Entladen (heute)";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_discharge_today + ' kWh'";
+            }
+
+
+            {
+              title     = "Geladen (gesamt)";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_charge_total + ' kWh'";
+            }
+
+            {
+              title     = "Entladen (gesamt)";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_discharge_total + ' kWh'";
+            }
+
+            {
+              title     = "Spannung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_voltage + ' V'";
+            }
+
+            {
+              title     = "Strom";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_current + ' A'";
+            }
+            {
+              title     = "Leistung";
+              type      = "text";
+              topic     = "solax2mqtt";
+              icon      = "icons/power.png";
+              transform = "return message.battery_power + ' W'";
+            }
+          ];
+        }
+      ];
+    }
+
+  ];
+
+}+
\ No newline at end of file
diff --git a/machines/lollo/solar-nrw/mqtt-webui/default.nix b/machines/lollo/solar-nrw/mqtt-webui/default.nix
@@ -0,0 +1,40 @@
+{ inputs, lib, pkgs, config, ... }:
+
+let
+
+  configFile = pkgs.writeTextDir "config.json" (builtins.toJSON (import ./config.nix));
+
+in {
+
+  dns.zones."ctu.cx".subdomains."solar-system-nrw".CNAME = lib.mkIf config.networking.usePBBUplink [ "${config.networking.fqdn}." ];
+
+  services = {
+    nginx    = {
+      enable = true;
+      virtualHosts."solar-system-nrw.ctu.cx" = {
+        enableACME = lib.mkIf config.networking.usePBBUplink true;
+        forceSSL   = lib.mkIf config.networking.usePBBUplink true;
+        kTLS       = lib.mkIf config.networking.usePBBUplink true;
+
+        locations  = {
+          "/" = {
+            root  = "${pkgs.buildEnv {
+              name  = "mqtt-webui-env";
+              paths = [
+                pkgs.mqtt-webui
+                configFile
+                ./extra-files
+              ];
+            }}/";
+          };
+          "/mqtt" = {
+            proxyPass       = "http://127.0.0.1:9005";
+            proxyWebsockets = true;
+          };
+        };
+      };
+    };
+
+  };
+
+}+
\ No newline at end of file
diff --git a/machines/lollo/solar-nrw/mqtt-webui/extra-files/manifest.json b/machines/lollo/solar-nrw/mqtt-webui/extra-files/manifest.json
@@ -0,0 +1,13 @@
+{
+	"name": "Solar System NRW",
+	"short_name": "Solar System",
+	"start_url": ".",
+	"display": "standalone",
+	"icons": [
+		{
+			"src": "favicon-512x512.png",
+			"sizes": "512x512",
+			"type": "image/png"
+		}
+	]
+}
diff --git a/machines/lollo/solar-nrw/solax2mqtt.nix b/machines/lollo/solar-nrw/solax2mqtt.nix
@@ -0,0 +1,56 @@
+{ inputs, config, pkgs, ... }:
+
+{
+
+  imports = [
+    ./vpn.nix
+  ];
+
+  age.secrets = {
+    solax2mqtt-config.file = ../../../secrets/lollo/solar-nrw/solax2mqtt.age;
+  };
+
+  services.mosquitto.enable = true;
+
+  systemd.services.solax2mqtt = {
+    wantedBy  = [ "multi-user.target" ];
+    requires  = [ "network-online.target" "strongswan.service" "mosquitto.service" ];
+    after     = [ "network-online.target" "strongswan.service" "mosquitto.service" ];
+    onFailure = [ "email-notify@%i.service" ];
+
+    environment.CONFIG_PATH = "%d/config.json";
+
+    serviceConfig = {
+      ExecStart    = "${pkgs.solax2mqtt}/bin/solax2mqtt";
+
+      Restart      = "on-failure";
+      RestartSec   = "5";
+
+      LoadCredential = "config.json:${config.age.secrets.solax2mqtt-config.path}";
+
+      DynamicUser = true;
+
+      NoNewPrivileges         = true;
+      PrivateTmp              = true;
+
+      ProtectSystem           = "strict";
+      ProtectKernelLogs       = true;
+      ProtectKernelModules    = true;
+      ProtectKernelTunables   = true;
+      ProtectControlGroups    = true;
+      ProtectHome             = true;
+
+      IPAddressAllow          = "127.0.0.0/8 192.168.178.75/32";
+
+      RestrictAddressFamilies = "AF_INET";
+      RestrictNamespaces      = true;
+      RestrictRealtime        = true;
+
+      DevicePolicy            = "closed";
+      LockPersonality         = true;
+
+      LimitNPROC              = 1;
+    };
+  };
+
+}
diff --git a/machines/lollo/solar-nrw/telegraf.nix b/machines/lollo/solar-nrw/telegraf.nix
@@ -0,0 +1,31 @@
+{ inputs, config, ... }:
+
+{
+
+  services.telegraf = {
+    enable = true;
+    extraConfig = {
+      inputs = {
+        mqtt_consumer = {
+          servers     = [ "tcp://127.0.0.1:1883" ];
+          topics      = [
+            "solax2mqtt"
+          ];
+          data_format = "json";
+        };
+      };
+      outputs = {
+        influxdb_v2 = [
+          {
+            urls         = [ "https://influx.home.ctu.cx" ];
+            organization = "leah";
+            bucket       = "solaxData";
+            token        = "\${INFLUX_TOKEN_SOLAXDATA}";
+            tagpass.topic = [ "solax2mqtt" ];
+          }
+        ];
+      };
+    };
+  };
+
+}+
\ No newline at end of file
diff --git a/machines/lollo/solar-nrw/vpn.nix b/machines/lollo/solar-nrw/vpn.nix
@@ -0,0 +1,57 @@
+{ pkgs, config, ... }:
+
+{
+
+  age.secrets = {
+    wegberg-vpn-secrets.file = ../../../secrets/lollo/solar-nrw/vpn-secrets.age;
+  };
+
+  services.strongswan = {
+    enable = true;
+
+    setup.uniqueids = "yes";
+
+    connections = {
+      avm_conntype_user = {
+        ikelifetime="60m";
+        keylife="60m";
+        rekeymargin="3m";
+        keyingtries="1";
+        ike="aes256-sha512-modp1024!";
+        esp="aes256-sha512!";
+        keyexchange="ikev1";
+        aggressive="yes";
+        leftauth="psk";
+        leftauth2="xauth";
+        leftsourceip="%config4";
+        dpdtimeout="120s";
+        dpdaction="restart";
+        dpddelay="30s";
+        forceencaps="yes";
+        modeconfig="pull";
+        compress="no";
+        rightauth="psk";
+        xauth="client";
+      };
+
+      wegberg = {
+        also="avm_conntype_user";
+        left = "%any4";
+        leftid="keyid:wegberg";
+        right="%i507mutylxhw1ptw.myfritz.net";
+        rightid="%any";
+        rightsubnet="192.168.178.0/24";
+        xauth_identity="wegberg";
+        esp="aes256-sha1!";
+        auto="start";
+        dpdaction="restart";
+        closeaction="restart";
+        keyingtries="%forever";
+      };
+    };
+
+    secrets = [ config.age.secrets.wegberg-vpn-secrets.path ];
+
+  };
+
+}+
\ No newline at end of file
diff --git a/secrets/lollo/mosquitto/passwd-nrw.age b/secrets/lollo/mosquitto/passwd-nrw.age
@@ -0,0 +1,11 @@
+-----BEGIN AGE ENCRYPTED FILE-----
+YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAvR2U0L2tYUkk5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CZDlWd2tOeHcKLT4gc3NoLWVkMjU1MTkgMXJjY0t3IEow
+Nm5YVDBndnpwVWlYOFhWWDJIT0hVZmFvN3Fnd0I3UXV5dzdtOVJ4SFUKUlZwT2pN
+QVpxRzliWWtKR3JFSWw0eE9meGVhOFFTRHNaVm5kZlVLL2FMawotPiBDNXw7PVh0
+LWdyZWFzZSAjMl9pfgpnc0ZWSS90a2xnSlJiYVQ5SjY2SFpEZTVpZk5SNVk3dW5x
+VGFEUWNVNm8wRUE1UWp6UTlZazBWNFdSR3ZSUDhBCitXcTJXdUdGeGttMUhTRzJG
+VHAxVmdkVGloTk4rcE9MT2NvcnY5bHVoRGdDTThid3NKaEwKLS0tIGRocTl6Z0FT
+U09vbHFNaXV5V0VsWTlVNnZJeTR0ejgvbVI5YUxqN3ZQTEUKLsAioQq+PDb6YZiQ
+910JG41F8G73T0b/um5VX+akkpgAwQcl5e2tKt8uF1WL5MTHy7CFpxMq6CHhCw/V
+Y2D5gk9J9xdiaKOUlaGP/vvTAT6Zud0UjQMRlTgju9DP2XtEAjP/5DAZI+IEc6S2
+3TFffoZSyqOCPgCdm8JIX/uHSpPm60HtY+4PYQ/F+TnCF7CDFURO3by2rQEHYF/Y
+wrnqv9m1Wy1K9nZgPJkrqJJzI1R4/UhlN42i+6Hli/G8qjCCAcmTDzonrMs6yOZs
+D38lTVS99Lod3VR5mwqjVeAj19W/kcwEB8NFg5zw3ubA38Dy3EpDvwZCUysqh1Dl
+WxPR6deL
 -----END AGE ENCRYPTED FILE-----
diff --git a/secrets/secrets.nix b/secrets/secrets.nix
@@ -29,6 +29,8 @@ in {
   "lollo/gotosocial-env.age".publicKeys                       = [ leah lollo ];
 
   "lollo/mosquitto/passwd-leah.age".publicKeys                = [ leah lollo ];
+  "lollo/mosquitto/passwd-nrw.age".publicKeys                 = [ leah lollo ];
+
   "lollo/zigbee2mqtt/secrets.age".publicKeys                  = [ leah lollo ];
   "lollo/telegraf_env.age".publicKeys                         = [ leah lollo ];
 

@@ -63,6 +65,8 @@ in {
   "lollo/restic/syncthing-cutieshare.age".publicKeys          = [ leah lollo ];
   "lollo/restic/syncthing-wiki.age".publicKeys                = [ leah lollo ];
 
+  "lollo/solar-nrw/vpn-secrets.age".publicKeys                = [ leah lollo ];
+  "lollo/solar-nrw/solax2mqtt.age".publicKeys                 = [ leah lollo ];
 
   "lollo-old/syncthing/key.age".publicKeys                    = [ leah lollo-old ];
   "lollo-old/syncthing/cert.age".publicKeys                   = [ leah lollo-old ];