diff --git a/nixos/systems/blowhole/default.nix b/nixos/systems/blowhole/default.nix index 0437c80..bc6e91d 100644 --- a/nixos/systems/blowhole/default.nix +++ b/nixos/systems/blowhole/default.nix @@ -98,6 +98,19 @@ in system.stateVersion = "21.05"; boot.kernel.sysctl."fs.inotify.max_user_instances" = 256; + services.udev.extraRules = + let + devPath = + "/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_4c004e9c53c9eb118a9f8b4f1d69213e-if00-port0"; + zigbeeScript = pkgs.writeShellScript "zigbeeScript" '' + ${pkgs.lib.getExe' pkgs.utillinux "mount"} --bind \ + "$(${pkgs.lib.getExe' pkgs.coreutils "readlink"} -f "${devPath}")" \ + /dev/ttyZigbee + ''; + in + '' + ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="10c4", ATTR{idProduct}=="ea60", RUN+="${zigbeeScript}" + ''; }); }; } diff --git a/terranix/containers/home-assistant/job.hcl b/terranix/containers/home-assistant/job.hcl index e0b64f9..ea2bfad 100644 --- a/terranix/containers/home-assistant/job.hcl +++ b/terranix/containers/home-assistant/job.hcl @@ -82,7 +82,7 @@ job "home-assistant" { devices = [ { - host_path = "/dev/ttyUSB0" #"serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_4c004e9c53c9eb118a9f8b4f1d69213e-if00-port0" + host_path = "/dev/ttyZigbee" #"serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_4c004e9c53c9eb118a9f8b4f1d69213e-if00-port0" container_path = "/dev/ttyUSB0" } ]