DS18X20 Sensor on RPI config problem

Started by Eisbaeeer, November 12, 2019, 08:55:54 AM

Previous topic - Next topic

Eisbaeeer

Hi
I run into config problems with OneWire Sensor.
The subAgent is loading but always got the message:

2019.11.12 07:47:00.477 *W* Unable to add sensor from configuration file. Original configuration record:
2019.11.12 07:47:00.478 *I* Subagent "DS18X20" (ds18x20.nsm) loaded successfully (version 2.2.8)


The sensor is working and I got some temperatures from it:

:/sys/bus/w1/devices/28-0000022801e4# cat w1_slave
35 01 4b 46 7f ff 0b 10 31 : crc=31 YES
35 01 4b 46 7f ff 0b 10 31 t=19312


The config looks like this, but tried some other things more by try-and-error:

SubAgent = ds18x20.nsm

# 1Wire Seonsors
[DS18X20]
Sensor = Test:28-0000022801e4


Are there anybody who can provide a working "config" or has hints of that issue?
A higher debug level donĀ“t tell me more informations about the config problem.

Thank you guys for your help!

Filipp Sudanov

#1
Hi!

Let me describe the whole configuration process for DS18x20 sensors on RPi in case if someone needs this later.
1) A pull-up resistor of 2..10KOhm should be connected between DQ pin of the sensor and +3.3v. GPIO2 and GPIO3 have built-in 1.8KOhm pull-up resistors (at least on RPi 3), so if you don't need I2C, you can connect the sensor to one of these pins.
2) A kernel module is used to communicate with the sensor. It is activated ty adding dtoverlay=w1-gpio to the end of /boot/config.txt file.
By default the DQ pin of the sensor should be connected to GPIO4, to use another GPIO the following format could be used: dtoverlay=w1-gpio,gpiopin=3. Reboot RPi when finished editing the file.
Since kernel version 4.9.28 it's also possible to use dynamic overlay loading: sudo dtoverlay w1-gpio gpiopin=5, in this way it's possible to have sensors on several GPIO pins.
3) After restart (of after dynamic overlay loading) the sensors should get detected:
root@raspberrypi:~# ls  /sys/bus/w1/devices/
28-6cb0611f64ff  w1_bus_master1

here we have one sensor connected, it has name 28-6cb0611f64ff
4) And we should be able to read the temperature:
root@raspberrypi:~# cat /sys/bus/w1/devices/28-6cb0611f64ff/w1_slave
78 01 55 00 7f ff 0c 10 57 : crc=57 YES
78 01 55 00 7f ff 0c 10 57 t=23500

which in this case is 23,5 degrees C.
5) To configure NetXMS agent we add the following lines to /etc/nxagentd.conf
SubAgent=ds18x20.nsm

[DS18X20]
Sensor = Test:28-6cb0611f64ff

6) After agent restart systemctl restart nxagentd our parameter "Test" should return the temperature.
user@netxms-server:~$ nxget raspberrypi.lan 'Sensor.Temperature(Test)'
23.312



Your configuration looks exactly the same. The thing is that the error message in agent log "Unable to add sensor from configuration file. Original configuration record:" looks to be a bug, i am also getting it (as of v. 3.1.274). But the parameter works. Most probably on your system Sensor.Temperature(Test) will also give the result.