summaryrefslogtreecommitdiffstats
path: root/makefu
diff options
context:
space:
mode:
Diffstat (limited to 'makefu')
-rw-r--r--makefu/0tests/data/secrets/zigbee2mqtt.nix6
-rw-r--r--makefu/2configs/home/ham/zigbee2mqtt/default.nix49
2 files changed, 52 insertions, 3 deletions
diff --git a/makefu/0tests/data/secrets/zigbee2mqtt.nix b/makefu/0tests/data/secrets/zigbee2mqtt.nix
new file mode 100644
index 000000000..c67ff3865
--- /dev/null
+++ b/makefu/0tests/data/secrets/zigbee2mqtt.nix
@@ -0,0 +1,6 @@
+{
+ mqtt.password = "hass";
+ mqtt.username = "hass";
+ zigbee.network_key = [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ];
+}
+
diff --git a/makefu/2configs/home/ham/zigbee2mqtt/default.nix b/makefu/2configs/home/ham/zigbee2mqtt/default.nix
index a75075273..83c3c187c 100644
--- a/makefu/2configs/home/ham/zigbee2mqtt/default.nix
+++ b/makefu/2configs/home/ham/zigbee2mqtt/default.nix
@@ -2,23 +2,66 @@
let
dataDir = "/var/lib/zigbee2mqtt";
+ sec = import <secrets/zigbee2mqtt.nix>;
in
{
# symlink the zigbee controller
+ #services.udev.extraRules = ''
+ # SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
+ #'';
services.udev.extraRules = ''
- SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
+ SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
'';
services.zigbee2mqtt = {
enable = true;
inherit dataDir;
+ config = {
+ permit_join = true;
+ serial.port = "/dev/cc2531";
+ homeassistant = true;
+ mqtt = {
+ server = "mqtt://omo.lan:1883";
+ base_topic = "/ham/zigbee";
+ user = sec.mqtt.username;
+ password = sec.mqtt.password;
+ include_device_information = true;
+ client_id = "zigbee2mqtt";
+ };
+ advanced = {
+ log_level = "debug";
+ log_output = [ "console" ];
+ last_seen = "ISO_8601";
+ elapsed = true;
+ reporting = true; # TODO test if it is better with groups
+ pan_id = 6755;
+ inherit (sec.zigbee) network_key;
+ };
+ map_options.graphviz.colors = {
+ fill = {
+ enddevice = "#fff8ce" ;
+ coordinator = "#e04e5d";
+ router = "#4ea3e0";
+ };
+ font = {
+ coordinator= "#ffffff";
+ router = "#ffffff";
+ enddevice = "#000000";
+ };
+ line = {
+ active = "#009900";
+ inactive = "#994444";
+ };
+ };
+ };
};
- state = [ "${dataDir}/configuration.yaml" "${dataDir}/state.json" ];
+ state = [ "${dataDir}/devices.yaml" "${dataDir}/state.json" ];
systemd.services.zigbee2mqtt = {
# override automatic configuration.yaml deployment
- serviceConfig.ExecStartPre = lib.mkForce "${pkgs.coreutils}/bin/true";
+ environment.ZIGBEE2MQTT_DATA = dataDir;
+ #serviceConfig.ExecStartPre = lib.mkForce "${pkgs.coreutils}/bin/true";
after = [
"home-assistant.service"
"mosquitto.service"