udevadm
[usb-wde1-tools.git] / README.rst
index 87a7d4b46f6898a20f8b69a74e896340c9b18ca3..9467f8e92abba7a3cddb19ddd190201c4e40f8c9 100644 (file)
@@ -28,20 +28,29 @@ Setup
 
      $ cd munin && nohup ./usb-wde1-log-last.sh &
 
-   once. It backgrounds the logging process and logs into /tmp/usb-wde1-last.
+   once. It backgrounds the logging process and logs into ``/var/spool/usb-wde1/usb-wde1-last``.
    This process needs to be started whenever the machine is rebooted.
 
+   The ``systemd/`` directory contains a ``usb-wde1-log.service`` file you can copy to
+   ``/etc/systemd/system/``. After copying it, run::
+
+     $ systemctl daemon-reload
+     $ systemctl start usb-wde1-log
+     $ systemctl status usb-wde1-log
+     $ systemctl enable usb-wde1-log
+
 2. Link the munin plugin::
 
    $ cd /etc/munin/plugins
    $ ln -s /usr/local/src/usb-wde1-tools/munin/usb-wde1_ usb-wde1_temperature
    $ ln -s /usr/local/src/usb-wde1-tools/munin/usb-wde1_ usb-wde1_humidity
 
-3. Configure the plugins
-   Edit /etc/munin/plugin-conf.d/munin-node and add the following lines::
+3. Configure the plugins:
+
+   Edit ``/etc/munin/plugin-conf.d/munin-node`` and add the following lines::
 
      [usb-wde1_*]
-     env.logfile /tmp/usb-wde1-last
+     env.logfile /var/spool/usb-wde1/usb-wde1-last
      env.host_name House
      env.sensors 0 1 7
      env.sensor0 Living room
@@ -119,3 +128,32 @@ Install PHP and the PHP rrd extension (``pear install pecl/rrd``) to make it
 work.
 
 Run ``gen-html.php`` every 5 minutes.
+
+
+Static USB device name
+======================
+When you have multiple serial USB devices attached to the computer,
+rebooting may lead to switched ttyUSB* numbers.
+
+A solution is to define a udev rule in ``/etc/udev/rules.d/99-usb-wde1.rules``::
+
+  SUBSYSTEM=="tty", ATTRS{serial}=="XQJ2EJEMADDFYBD3", SYMLINK+="usbwde1"
+
+You can find the serial number in ``dmesg`` output::
+
+  usb 1-3: new full-speed USB device number 2 using xhci_hcd
+  usb 1-3: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00
+  usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
+  usb 1-3: Product: ELV USB-WDE1 Wetterdatenempfänger
+  usb 1-3: Manufacturer: Silicon Labs
+  usb 1-3: SerialNumber: XQJ2EJEMADDFYBD3
+
+After creating the file, activate it::
+
+  $ udevadm control --reload
+  $ udevadm trigger
+
+Now a file ``/dev/usbwde1`` exists.
+
+Modify ``munin/usb-wde1-log-last.sh`` to use the new device file instead
+of ``ttyUSB0``.