From 57bcf4d33c42f3e19f2ac664892494fd3df8363e Mon Sep 17 00:00:00 2001 From: soraefir Date: Thu, 21 May 2026 03:18:36 +0200 Subject: [PATCH] openhab setup --- modules/server/containers/apps/openhab.nix | 33 ++++++++++++++++------ 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/modules/server/containers/apps/openhab.nix b/modules/server/containers/apps/openhab.nix index 35bd776..00504ff 100644 --- a/modules/server/containers/apps/openhab.nix +++ b/modules/server/containers/apps/openhab.nix @@ -7,9 +7,9 @@ in { sops = false; db = false; paths = [ - { path="${serverCfg.configPath}/openhab/conf"; owner="9001:9001"; mode = "0755"; } - { path="${serverCfg.configPath}/openhab/userdata"; owner="9001:9001"; mode = "0755"; } - { path="${serverCfg.configPath}/openhab/addons"; owner="9001:9001"; mode = "0755"; } + { path="${serverCfg.configPath}/openhab/conf"; owner="1000:1000"; mode = "0755"; } + { path="${serverCfg.configPath}/openhab/userdata"; owner="1000:1000"; mode = "0755"; } + { path="${serverCfg.configPath}/openhab/addons"; owner="1000:1000"; mode = "0755"; } ]; containers = { @@ -18,9 +18,9 @@ in { image = "openhab/openhab:${version}"; port = 8080; extraEnv = { - # USER_ID = "1000"; - # GROUP_ID = "1000"; - # CRYPTO_POLICY = "unlimited"; + USER_ID = "1000"; + GROUP_ID = "1000"; + CRYPTO_POLICY = "unlimited"; OPENHAB_HTTP_PORT = "8080"; }; extraOptions = [ @@ -38,21 +38,36 @@ in { setup = { trigger = "server"; + envFile = [ config.sops.secrets."CUSTOM".path ]; script = pkgs.writeShellScript "setup" '' # Pre-generate openHAB directories on the host OHAB="${pkgs.podman}/bin/podman --events-backend=none exec openhab-server /openhab/runtime/bin/client -u openhab -p habopen" sleep 20 exit 0 + $OHAB openhab:users add $DEFAULT_ADMIN_USERNAME $DEFAULT_ADMIN_PASSWORD administrator $OHAB feature:list - #TODO: Install DB (influx, mapdb,...) - #TODO: Install! telegram, matter, mqtt, bluetooth, chromecast, PublicTransportSwitzerland, zigbee, OpenMeteoWeatherForecast + $OHAB openhab:addons install persistance-mapdb + $OHAB openhab:addons install persistance-influxdb + + $OHAB openhab:addons install ui-basic + $OHAB openhab:addons install automation-jsscripting + + $OHAB openhab:addons install binding-telegram + $OHAB openhab:addons install binding-matter + $OHAB openhab:addons install binding-mqtt + $OHAB openhab:addons install binding-bluetooth + $OHAB openhab:addons install binding-zigbee + $OHAB openhab:addons install binding-chromecast + $OHAB openhab:addons install binding-astro + $OHAB openhab:addons install binding-meteoblue + $OHAB openhab:addons install binding-publictransportswitzerland #IF APPLE DEVICE: HomeKit (siri/apple bridge) #IF UBIQUITY NET: Unifi + UnifiProtect (net/cam bridge) #IF YAMAHA+EPSON: EpsonProjector + Yamaha (projector and sound) #IF BAMBULAB DEVICE: BambuLab (notify print state) #IF GARDENA DEVICE: Gardena (smart watering) - #IF AndroidTV/Jellyfin: Bind with lights + more + #Extra: AndroidTV/Jellyfin (Bind with lights + more) ''; }; } \ No newline at end of file