owfss - weewx/weewx GitHub Wiki

Overview for using owfs as a service (to supplement the main driver)

If required, read Use one-wire sensors with weeWX for the introduction.

OWFS Service

OWFS (one-wire file system) provides access to data from one-wire sensors as if they were files in the computer's file system.

This is a service for weewx that collects data from one-wire sensors using owfs.

Requirements

When using pyownet and python 3.x, owserver is required

sudo apt install owserver

and the contents of /etc/owfs.conf will be modified.

To configure the owserver, move aside the contents of /etc/owfs.conf and create
a new file with the contents as follows, but uncommenting one of the first 3
device entries that suits your setup...
    #! server: server = localhost:4304
    #server: usb = all # for a DS9490
    #server: device = /dev/ttyS1 # for a serial port
    #server: device /dev/i2c-1 # for a pi using i2c-1
    server: port = 4304

Download

wget -O weewx-owfs.zip https://github.com/matthewwall/weewx-owfs/archive/master.zip

How to Install

  1. Install the python bindings. For example, on debian systems running python 2 versions: :
sudo apt-get install python-ow

or if using weewx4 with python 3

sudo apt-get install pyownet

if it is not available via apt-get then uses pip3 (apt-get install pip3-python to install pip3 )

pip3 install pyownet

  1. Run the extension installer:
weectl extension install weewx-owfs.zip
  1. Find out what sensors are attached:
# if you installed using setup.py:
sudo PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/owfs.py --sensors

# if you installed from rpm or deb package:
sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/owfs.py --sensors
  1. Get some data from the sensors:
# if you installed using setup.py:
sudo PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/owfs.py --readings

# if you installed from rpm or deb package:
sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/owfs.py --readings
  1. Modify weewx.conf:

Specify the interface, sensor map and possibly sensor types:

    [OWFS]
        interface = u
        [sensor_map](/weewx/weewx/wiki/sensor_map)
            outTemp = /uncached/28.8A071E050000/temperature
            UV = /uncached/EE.1F20CB020800/UVI/UVI
            radiation = /26.FB67E1000000/S3-R1-A/luminosity
            lightning = /1D.1AD00F000000/counters.A
        [sensor_type](/weewx/weewx/wiki/sensor_type)
            lightning = counter

Add OWFSService to the service list:

    [Engine]
        [Services](/weewx/weewx/wiki/Services)
            data_services = user.owfs.OWFSService

Add calibration corrections for individual sensors:

    [StdCalibrate]
        [Corrections](/weewx/weewx/wiki/Corrections)
            radiation = radiation * 1.7304636. 
  1. Start weewx
sudo systemctl start weewx

Caveats

The order of the services matters. Be sure that OWFSService runs before StdCalibrate, StdQC, and StdArchive.

The interface defaults to 'u', which is short for 'usb'. This is the interface for a DS9490R USB adaptor. Other options for interface include a serial port such as '/dev/ttyS0', or a remote one-wire server such as 'remote_system:3003'.

If you are using a one-wire-to-USB adapter, then the default interface of 'u' should work. If your one-wire devices are attached via serial port, i2c, or some other physical interface, then you will have to specify the interface when running owfs.py direction and when configuring owfs.py to run as a service or driver. Use the --iface option on the command-line or the interface option in the OWFS section of weewx.conf.

See the comments in owfs.py for additional options and for examples of how to configure for specific devices.

The sensor map is simply an association between fields in the weewx database schema and paths to one-wire devices. Preface a path with /uncached to skip the cache.

The default sensor type is 'gauge' - data from the sensor are saved directly. Other types include 'delta' (difference between current and last samples), 'counter' (similar to delta, but always increasing), and 'average' (delta divided by sample period). Some specific one-wire devices are also supported such as Hobby Boards ADS and Inspeed anemometers and AAG anemometer. See the comments in owfs.py for details and sample configurations.

By default, this driver assumes that all data from the sensors are in metric units. Use the unit_system option if the sensors return data in US customary units.

The service will work only with sensor values that can be converted to float.

Use the corrections in StdCalibrate to calibrate raw data.

The ow utilities owftpd, owhttpd, and owserver are part of the owfs package, not part of the weewx owfs extension. They might be helpful for debugging and diagnostics, but they do not need to be running and do not even need to be installed.

Some sensors require a recent build of owfs. If your sensor is not recognized, try updating owfs or compile it yourself.

Here is a minimal configuration to compile owfs:

./configure --prefix=/opt/owfs-2.9p8 --disable-parport --disable-zero \
--disable-owtcl --enable-owpython --disable-owphp --disable-owperl \
--disable-owcapi --disable-owmon --disable-owexternal --disable-owserver \
--disable-owftpd --disable-owhttpd --disable-owtap --disable-w1 \
--disable-i2c --disable-ownetlib --disable-owshell --disable-ownet

Source code

https://github.com/matthewwall/weewx-owfs