From 6668542d5370d5277e4dc2e688cfaa779a194d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Wed, 4 Nov 2020 08:51:19 +0100 Subject: [PATCH] chore: clean up zigbee2mqtt config --- configs/hass/zigbee.nix | 53 ++++++++++++----------------------------- 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/configs/hass/zigbee.nix b/configs/hass/zigbee.nix index eca684a..7c117a9 100644 --- a/configs/hass/zigbee.nix +++ b/configs/hass/zigbee.nix @@ -1,50 +1,27 @@ { config, pkgs, lib, ... }: let inherit (import ) localAddresses; - zigbee2mqttDevice = "/dev/ttyACM0"; - - zigbee2mqttConfig = { - permit_join = false; - homeassistant = true; - serial = { - port = zigbee2mqttDevice; - disable_led = true; - }; - mqtt = { - discovery = true; - base_topic = "zigbee"; - server = "mqtt://${localAddresses.toum}"; - user = "albrecht"; - password = lib.strings.fileContents ; - }; - }; - zigbee2mqtt_cfg = pkgs.writeText "zigbee2mqtt.json" (builtins.toJSON zigbee2mqttConfig); in { services.zigbee2mqtt = { enable = true; - config = zigbee2mqttConfig; + config = { + permit_join = false; + homeassistant = true; + serial = { + port = "/dev/ttyACM0"; + disable_led = true; + }; + mqtt = { + discovery = true; + base_topic = "zigbee"; + server = "mqtt://${localAddresses.toum}"; + user = "albrecht"; + password = lib.strings.fileContents ; + }; + }; }; - - /* - system.activationScripts.installZigbee = '' - install -d /var/lib/zigbee2mqtt - install ${zigbee2mqtt_cfg} /var/lib/zigbee2mqtt/configuration.yaml - ''; - - # hack to restart docker container on config change - systemd.services.docker-zigbee2mqtt.environment.cfg = zigbee2mqtt_cfg; - - docker-containers.zigbee2mqtt = { - image = "koenkk/zigbee2mqtt"; - extraDockerOptions = [ - "--device=${zigbee2mqttDevice}:${zigbee2mqttDevice}" - ]; - volumes = ["/var/lib/zigbee2mqtt:/app/data"]; - }; - */ - services.mosquitto = { enable = true; host = "0.0.0.0";