summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/zigbee2mqtt/default.nix
diff options
context:
space:
mode:
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"
+ ];
+ };
+}