openhab setup

This commit is contained in:
soraefir
2026-05-21 03:18:36 +02:00
parent 7cc516a0be
commit 57bcf4d33c

View File

@@ -7,9 +7,9 @@ in {
sops = false; sops = false;
db = false; db = false;
paths = [ paths = [
{ path="${serverCfg.configPath}/openhab/conf"; owner="9001:9001"; mode = "0755"; } { path="${serverCfg.configPath}/openhab/conf"; owner="1000:1000"; mode = "0755"; }
{ path="${serverCfg.configPath}/openhab/userdata"; owner="9001:9001"; mode = "0755"; } { path="${serverCfg.configPath}/openhab/userdata"; owner="1000:1000"; mode = "0755"; }
{ path="${serverCfg.configPath}/openhab/addons"; owner="9001:9001"; mode = "0755"; } { path="${serverCfg.configPath}/openhab/addons"; owner="1000:1000"; mode = "0755"; }
]; ];
containers = { containers = {
@@ -18,9 +18,9 @@ in {
image = "openhab/openhab:${version}"; image = "openhab/openhab:${version}";
port = 8080; port = 8080;
extraEnv = { extraEnv = {
# USER_ID = "1000"; USER_ID = "1000";
# GROUP_ID = "1000"; GROUP_ID = "1000";
# CRYPTO_POLICY = "unlimited"; CRYPTO_POLICY = "unlimited";
OPENHAB_HTTP_PORT = "8080"; OPENHAB_HTTP_PORT = "8080";
}; };
extraOptions = [ extraOptions = [
@@ -38,21 +38,36 @@ in {
setup = { setup = {
trigger = "server"; trigger = "server";
envFile = [ config.sops.secrets."CUSTOM".path ];
script = pkgs.writeShellScript "setup" '' script = pkgs.writeShellScript "setup" ''
# Pre-generate openHAB directories on the host # 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" OHAB="${pkgs.podman}/bin/podman --events-backend=none exec openhab-server /openhab/runtime/bin/client -u openhab -p habopen"
sleep 20 sleep 20
exit 0 exit 0
$OHAB openhab:users add $DEFAULT_ADMIN_USERNAME $DEFAULT_ADMIN_PASSWORD administrator
$OHAB feature:list $OHAB feature:list
#TODO: Install DB (influx, mapdb,...) $OHAB openhab:addons install persistance-mapdb
#TODO: Install! telegram, matter, mqtt, bluetooth, chromecast, PublicTransportSwitzerland, zigbee, OpenMeteoWeatherForecast $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 APPLE DEVICE: HomeKit (siri/apple bridge)
#IF UBIQUITY NET: Unifi + UnifiProtect (net/cam bridge) #IF UBIQUITY NET: Unifi + UnifiProtect (net/cam bridge)
#IF YAMAHA+EPSON: EpsonProjector + Yamaha (projector and sound) #IF YAMAHA+EPSON: EpsonProjector + Yamaha (projector and sound)
#IF BAMBULAB DEVICE: BambuLab (notify print state) #IF BAMBULAB DEVICE: BambuLab (notify print state)
#IF GARDENA DEVICE: Gardena (smart watering) #IF GARDENA DEVICE: Gardena (smart watering)
#IF AndroidTV/Jellyfin: Bind with lights + more #Extra: AndroidTV/Jellyfin (Bind with lights + more)
''; '';
}; };
} }