Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/sensors/voltcraft_tcm220_ | ||
|---|---|---|
| 1 | 1 |
#!/usr/bin/perl -w |
| 2 | 2 |
########################################################################################################## |
| 3 | 3 |
# |
| 4 |
# Munin plugin to monitor values reported by a Voltcraft TCM 220 or 320 temperature swicth module
|
|
| 5 |
# connected to a serial port. A cable needs to be soldered to the module's dedicated data output pads:
|
|
| 6 |
# pad no. 9 (GND) to pin no. 5 of the serial port, pad no. 17 (DATA_OUT) to pin no. 2 of the serial port
|
|
| 7 |
# and pad no. 18 (CLOCK) to pin no. 3 of the serial port. For more details, check out the documentation
|
|
| 4 |
# Munin plugin to monitor values reported by a Voltcraft TCM 220 or 320 temperature swicth module |
|
| 5 |
# connected to a serial port. A cable needs to be soldered to the module's dedicated data output pads: |
|
| 6 |
# pad no. 9 (GND) to pin no. 5 of the serial port, pad no. 17 (DATA_OUT) to pin no. 2 of the serial port |
|
| 7 |
# and pad no. 18 (CLOCK) to pin no. 3 of the serial port. For more details, check out the documentation |
|
| 8 | 8 |
# that came with your Voltcraft TCM 220/320 temperature swicth module. |
| 9 | 9 |
# |
| 10 | 10 |
# In order to use this plugin, copy it to the munin's plugin directory (eg. /usr/share/munin/plugins) |
| ... | ... | |
| 15 | 15 |
# |
| 16 | 16 |
# Important: make sure to use the same names in your symlinks and other config places! |
| 17 | 17 |
# |
| 18 |
# 2. In /etc/munin/plugin-conf.d/munin-node add the following, to be able to contact the modules via
|
|
| 18 |
# 2. In /etc/munin/plugin-conf.d/munin-node add the following, to be able to contact the modules via |
|
| 19 | 19 |
# serial ports (obviously replacing these with your own data): |
| 20 | 20 |
# |
| 21 | 21 |
# [voltcraft_tcm220_serverroom1] |
| ... | ... | |
| 30 | 30 |
# |
| 31 | 31 |
# 3. Restart the munin node by 'service munin-node restart'. |
| 32 | 32 |
# |
| 33 |
# If all went well, after 5 minutes or so you should have tne new module's graphs listed on the Web
|
|
| 33 |
# If all went well, after 5 minutes or so you should have tne new module's graphs listed on the Web |
|
| 34 | 34 |
# Interface of Munin. |
| 35 | 35 |
# |
| 36 | 36 |
# Note: the plugin waits maximum 11 seconds for the module to report the current temperature values to |
| 37 |
# the serial port. If no value is reported, or the serial cable is unplugged, it returns Undefined to
|
|
| 37 |
# the serial port. If no value is reported, or the serial cable is unplugged, it returns Undefined to |
|
| 38 | 38 |
# Munin. According to the documentation, the module can be configured to report values every 2 seconds |
| 39 | 39 |
# instead the 10 seconds default - this can be used to speed up the data acquisition process, however |
| 40 | 40 |
# it can decrease battery life (with default values, two AAA alkaline batteries last cca 2 years). |
| ... | ... | |
| 119 | 119 |
my $ch2temp = "U"; |
| 120 | 120 |
|
| 121 | 121 |
if ($response // "") {
|
| 122 |
my $hex = unpack 'H*', $response;
|
|
| 122 |
my $hex = unpack 'H*', $response; |
|
| 123 | 123 |
# print "$hex\n"; #$hex should be something like "abc102999babc2017677" for +29.9 and +17.6 |
| 124 | 124 |
|
| 125 | 125 |
my $ch1sum = substr($hex, 4, 1) + substr($hex, 5, 1) + substr($hex, 6, 1) + substr($hex, 7, 1); |
Formats disponibles : Unified diff