How to list all DS18B20 (1wire temp sensors) on a bus



  • Hi all,

    I have several temp sensors (DS18B20) and would like to scan the bus. How can I do this?

    BTW, I'm new to Python, 1-wire and, of course, UniPi.

    Thx in adv,

    Jeff



  • Hi all,

    I have several temp sensors (DS18B20) and would like to scan the bus. How can I do this?

    BTW, I'm new to Python, 1-wire and, of course, UniPi.

    Thx in adv,

    Jeff



  • Hello Jeff,

    what software do you plan to use? If you use our evok api you have a complete control of the UniPi and, of course, you can see all connected DS18B20 sensors to the 1Wire network. If you have more sensors connected via the new 8port hub, make sure to connect them in the right order to the hub according to this wiki page.

    If you use the evok, all detected sensors will be displayed in the web interface. I am working on a API update to see list of all connected sensors and their types…

    Anyway you can use owserver (there are many tutorials on how to use the owserver on rpi i2c-1).

    Regards,
    Tomas



  • Thanks for the reply Thomas.

    I ordered an 8 port hub + extra temp sensors from you folks yesterday.

    For now I have 1 sensor connected to the RJ45 port but it shows up as "null" in the sensors section. I assume that's because the evok.conf file is looking for a specific 1-wire address (which is default in evok.conf and not this specific sensor).

    How can I list all addresses on the 1wire bus using evok (or any other mechanism for that matter)?

    I'll check out the owserver too. Maybe the answer's in there…



  • Hello Jeff,

    I have pushed a new RPC method to evok so now you can call s.owbus_list(1) to get list of all DS18(B/S)20 sensors… However if you see null value in the web UI it means that the value has not been read yet.



  • Hi Thomas - thanks again for the quick reply & adding the list method.

    I've upgraded everything from git and restarted evok.

    From what I can tell (noob here) - it looks like my script is effectively just reading the value from /etc/evok.conf

    Here's my script:

    from jsonrpclib import Server
    s=Server("http://127.0.0.1/rpc")
    print s.owbus_list(1)
    
    

    Whatever I set the SENSOR_1 address to in /etc/evok.conf is what gets displayed when I call s.owbus_list(1).

    Snippet from my /etc/evok.conf:

    ...
    [OWBUS_1]
    owbus = --i2c=/dev/i2c-1:ALL     ; scanned bus (--i2c=/dev/i2c-1:ALL or localhost:2122 or 'u' for USB dongle)
    interval = 3          ; [s] default sensor reading
    scan_interval = 300    ; [s] how often is made searching
    
    [SENSOR_1]           ; onewire thermometer
    bus = 1              ; link to I2CBUS_X
    address = 1067C6697351FF8D
    type = DS18B20
    interval = 1
    
    [I2CBUS_1]
    busid = 1               ;[integer] id of bus /dev/i2c-X
    ...
    
    

    I downloaded & setup OWFS/owserver. When I browse to my http://RPI_IP:2121 I get the following:

    top	highest level	directory
    10.67C6697351FF	10.67C6697351FF	directory
    05.4AEC29CDBAAB	05.4AEC29CDBAAB	directory
    bus.0	bus.0	directory
    uncached	uncached	directory
    settings	settings	directory
    system	system	directory
    statistics	statistics	directory
    structure	structure	directory
    simultaneous	simultaneous	directory
    alarm	alarm	directory
    
    ```I looked up the 1wire address family here: [http://owfs.sourceforge.net/family.html](http://owfs.sourceforge.net/family.html) and figured 1067C6697351FF was the single DS18B20 temp sensor that I have connected. I'm not sure this is correct since owfs is using the default "FAKE" config.
    
    Note, I'm using RPi 2B. Any additional insight would be greatly appreciated!


  • Check your owfs.conf file and comment out all fake devices so you actually see only real devices on the bus. I have pushed another update to the github so please do an update again (only the owclient.py file is needed to replace). Stop the evok service (service evok stop) and run it manually /opt/evok/evok.py as root and it will list all detected 1wire devices. Please upload the output of it here so I can see.



  • Thanks again for your assistance Thomas. From what I can tell it looks like the ow package isn't finding the controller so it's throwing.

    Here's the output from evok.py:

    root@rpi2:/opt/evok# ./evok.py 
    Listening on port: 80
    UniPi version:1.1
    Entering measure loop
    Process OwBusDriver-1:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
        self.run()
      File "/opt/evok/owclient.py", line 274, in run
        ow.init(self.bus)
      File "/usr/lib/python2.7/dist-packages/ow/__init__.py", line 224, in init
        raise exNoController
    exNoController
    New client connected
    [I 150409 14:55:46 web:1825] 200 GET /rest/all/ (192.168.0.156) 5.36ms
    
    

    With my /etc/owfs.conf set with no 'FAKE's it fails to start.

    pi@rpi2 /etc $ sudo service owserver start
    [FAIL] Starting 1-Wire TCP Server: owserver failed!

    /etc/owfs.conf:

    # Sample configuration file for the OWFS suite for Debian GNU/Linux.
    #
    #
    # This is the main OWFS configuration file. You should read the
    # owfs.conf(5) manual page in order to understand the options listed
    # here.
    
    ######################## SOURCES ########################
    #
    # With this setup, any client (but owserver) uses owserver on the
    # local machine...
    ! server: server = localhost:4304
    #
    # ...and owserver uses the real hardware, by default fake devices
    # This part must be changed on real installation
    #server: FAKE = DS18S20,DS2405
    #
    # USB device: DS9490
    #server: usb = all
    #
    # Serial port: DS9097
    #server: device = /dev/ttyS1
    #
    # owserver tcp address
    #server: server = 192.168.10.1:3131
    #
    # random simulated device
    #server: FAKE = DS18S20,DS2405
    #
    ######################### OWFS ##########################
    #
    #mountpoint = /mnt/1wire
    #allow_other
    #
    ####################### OWHTTPD #########################
    
    http: port = 2121
    
    ####################### OWFTPD ##########################
    
    ftp: port = 2120
    
    ####################### OWSERVER ########################
    
    server: port = localhost:4304
    
    

    Thanks again for your assistance.



  • According to the output it seems that the 1wire controller is not found. Try to install the i2c-tools package (sudo apt-get install i2c-tools) and send me output of i2c-detect -y 1… Thanks!