summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/zigbee2mqtt/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-03-12 20:32:34 +0100
committermakefu <github@syntax-fehler.de>2021-03-12 20:32:34 +0100
commit1da12adf038e962af76228b3e53d2eb8c0d367b2 (patch)
tree56d755aed00f5b109f09a061e97498b9771b66da /makefu/2configs/bureautomation/zigbee2mqtt/default.nix
parentc5e6e6ba31d67c148068ae14ab06d54e65ae495b (diff)
ma bureautomation/zigbee2mqtt: init
Diffstat (limited to 'makefu/2configs/bureautomation/zigbee2mqtt/default.nix')
-rw-r--r--makefu/2configs/bureautomation/zigbee2mqtt/default.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/makefu/2configs/bureautomation/zigbee2mqtt/default.nix b/makefu/2configs/bureautomation/zigbee2mqtt/default.nix
new file mode 100644
index 000000000..ba10ae74b
--- /dev/null
+++ b/makefu/2configs/bureautomation/zigbee2mqtt/default.nix
@@ -0,0 +1,33 @@
+{config, pkgs, lib, ...}:
+
+let
+ dataDir = "/var/lib/zigbee2mqtt";
+in
+ {
+ # symlink the zigbee controller
+ services.udev.extraRules = ''
+ SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
+ '';
+
+ services.zigbee2mqtt = {
+ enable = true;
+ inherit dataDir;
+ config = {
+ permit_join = true;
+ serial.port = "/dev/cc2531";
+ homeassistant = true;
+ };
+ };
+
+ state = [ "${dataDir}/devices.yaml" "${dataDir}/state.json" ];
+
+ systemd.services.zigbee2mqtt = {
+ # override automatic configuration.yaml deployment
+ environment.ZIGBEE2MQTT_DATA = dataDir;
+ after = [
+ "home-assistant.service"
+ "mosquitto.service"
+ "network-online.target"
+ ];
+ };
+}