Implementation of multiple DS18B20

Hello,

I would like to know about an issue which is appearing with multiple (10 sensors with 1-Wire) Temp (DS18B20) measurements with inputs.temp (Telegraf) and Chronograf on a RaspberryPI.
Apparently the temperature is correct gathered (10 measurements) by Telegraf but just one temperature is shown in InfluxDB. Has there to be an indexing eg temp(1), temp(i)?

How many sensors can handle Telegraf and influxdb?

Raspian Stretch
Raspi 3B+
Telegraf 1.9.1
InfluxDB 1.7.2
Chronograf 1.7.5

Nice greetings and thanks in advance

How are the 10 results distinguished at the source, and at the output of telegraf? Do you only see one entry in InfluxDB when you query directly, without Chronograf?

At Telegraf the 10 results are shown, so I assume the inputs.temp works corectly … see below.
And yes in the Influxdb is only the last entry of the Telegraf output listed.
The readout takes about 10-15 seconds.

At the source → As I understood every DS18B20 has its own serial number. [https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf (Description on Page 8)]

all 28-* are DS18B20 devices.

All 10 readings have identical timestamps… are they replacing previous readings instead of adding to the database store? What happens If you space them out by even 1 nsec between readings? Or include an extra tag that makes them unique, such as the DS18B20’s unique identifier.

Yeah, it looks like we need another tag here to uniquely identify the sensors. What is the output of ls -l /sys/class/hwmon/hwmon*/device/temp*?

Thank you for your suggestions! I would like to add the serial number as an extra tag, because if I add some more sensors on another GPIO it would not be problematic again. I am quite new to this field and I wonder how I can do that.

“are they replacing previous readings instead of adding to the database store?” actually, I know that the loggings are only from one sensor, the last read from the inputs.temp, because the temperature is significantly lower than the others. And this sensor shows over time the right data and is proper visualized in chronograf

and i can’t enter the folder via [cd]

Can you run the command without expanding the wildcards, and don’t complete with tab, I expect it should pick up a file for each sensor. I also notice that on some platforms it uses an alternate directory, so run both of these:

ls -l '/sys/class/hwmon/hwmon*/temp*'
ls -l '/sys/class/hwmon/hwmon*/device/temp*'

Thank you yes the other command worked!
and as you assumed there is a file for each sensor.

can I just rename the Sensor names?

The files in /sys are not normal files so you won’t be able to rename them. Could you also run these commands?

cat /sys/class/hwmon/hwmon0/temp1_label
cat /sys/class/hwmon/hwmon0/name

DS18B20s don’t have a _label file, which means that the SensorKey created by gopsutil is the same for all DS18B20s attached to a device

From the kernel documentation:

temp[1-*]_label	Suggested temperature channel label.
		Text string
		Should only be created if the driver has hints about what
		this temperature channel is being used for, and user-space
		doesn't. In all other cases, the label is provided by
		user-space.
		RO

Because the application of a DS18B20 and other similar sensors can vary, the driver is generic and does not have any information about what the temperature channel is being used for, so this file is not created.

The device name, however, is unique among DS18B20s and could be used to add tags to the measurement (/sys/class/hwmon/hwmon*/device/name).

I see, thank you! so can I just make a _label file and name (like the ID) each?

and with the

temp[1-*]_offset

i could perform a calibration?!

hey the name (/sys/class/hwmon/hwmon*/device/name) is not unique, as shown, I am not able to create (su) the temp1_label file.

image

I write solution for multiple.

I am new to Telegraf and I have the same situation with 2 1-wire temperature probes (DS18B20) on the same Raspberry Pi.

Is the sensors plugin being used here? If so, it looks like the underlying sensors executable has a limitation that could be related; it’s described in this GitHub issue: Multiple 1-wire sensors (e.g. DS18B20) indistinguishable · Issue #204 · lm-sensors/lm-sensors · GitHub. When running sensors, both probes are labeled as w1_slave_temp-virtual-0.