Better pin zigbee dongle serial device

Signed-off-by: magic_rb <richard@brezak.sk>
This commit is contained in:
magic_rb 2023-10-23 23:30:38 +02:00
parent 8f052ce05f
commit 2b11913dc9
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
2 changed files with 14 additions and 1 deletions

View file

@ -98,6 +98,19 @@ in
system.stateVersion = "21.05"; system.stateVersion = "21.05";
boot.kernel.sysctl."fs.inotify.max_user_instances" = 256; 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}"
'';
}); });
}; };
} }

View file

@ -82,7 +82,7 @@ job "home-assistant" {
devices = [ 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" container_path = "/dev/ttyUSB0"
} }
] ]