/**
- * collectd - src/owfs.c
- * Copyright (C) 2008 Florian octo Forster
+ * collectd - src/onewire.c
+ * Copyright (C) 2008 noris network AG
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
/* see http://owfs.sourceforge.net/ow_table.html for a list of families */
static ow_family_features_t ow_family_features[] =
{
- {
+ { /* DS18S20 Precision Thermometer and DS1920 ibutton */
/* family = */ "10.",
{
{
}
},
/* features_num = */ 1
+ },
+ { /* DS1822 Econo Thermometer */
+ /* family = */ "22.",
+ {
+ {
+ /* filename = */ "temperature",
+ /* type = */ "temperature",
+ /* type_instance = */ ""
+ }
+ },
+ /* features_num = */ 1
+ },
+ { /* DS18B20 Programmable Resolution Thermometer */
+ /* family = */ "28.",
+ {
+ {
+ /* filename = */ "temperature",
+ /* type = */ "temperature",
+ /* type_instance = */ ""
+ }
+ },
+ /* features_num = */ 1
+ },
+ { /* DS2436 Volts/Temp */
+ /* family = */ "1B.",
+ {
+ {
+ /* filename = */ "temperature",
+ /* type = */ "temperature",
+ /* type_instance = */ ""
+ }
+ },
+ /* features_num = */ 1
+ },
+ { /* DS2438 Volts/Temp */
+ /* family = */ "26.",
+ {
+ {
+ /* filename = */ "temperature",
+ /* type = */ "temperature",
+ /* type_instance = */ ""
+ }
+ },
+ /* features_num = */ 1
}
};
static int ow_family_features_num = STATIC_ARRAY_SIZE (ow_family_features);
static char *device_g = NULL;
-static int ow_interval = 0;
+static cdtime_t ow_interval = 0;
static const char *config_keys[] =
{
}
else if (strcasecmp ("Interval", key) == 0)
{
- int tmp;
- tmp = atoi (value);
- if (tmp > 0)
- ow_interval = tmp;
+ double tmp;
+ tmp = atof (value);
+ if (tmp > 0.0)
+ ow_interval = DOUBLE_TO_CDTIME_T (tmp);
else
ERROR ("onewire plugin: Invalid `Interval' setting: %s", value);
}
return (1);
}
- memset (&cb_interval, 0, sizeof (cb_interval));
- if (ow_interval > 0)
- cb_interval.tv_sec = (time_t) ow_interval;
+ CDTIME_T_TO_TIMESPEC (ow_interval, &cb_interval);
- plugin_register_complex_read ("onewire", cow_read,
- &cb_interval, /* user data = */ NULL);
+ plugin_register_complex_read (/* group = */ NULL, "onewire", cow_read,
+ (ow_interval != 0) ? &cb_interval : NULL,
+ /* user data = */ NULL);
plugin_register_shutdown ("onewire", cow_shutdown);
return (0);