This page last changed on May 23, 2013 by juha.

Hi Everyone,

First of all, can I say how great the OpenRemote stuff is However, I need a bit of help, please.

I'm trying to get OpenRemote working with OWFS, using the i2c bus master approach with Sheepwalk Electronic's DS18B20 sensors on a Raspberry Pi with latest Raspbian image. I installed OWFS using the apt-get method, and OpenRemote controller as per the on line instructions.

I have OWFS, OWSERVER, OWHTTPD, and OWFTPD services running. I have also tried this with OWFS not running at all, and have the same error (see below).

The basic 1-wire web server is responding on the default port (2121), and OWREAD commands (in an SSH session) work directly as expected. The OpenRemote designer is communicating with my Controller instance, which appears to be running OK, apart from the fact that I am getting an error message:-

ERROR [Polling thread for sensor: TestSensor]: OneWire error, unable to read from OWSERVER.
org.owfs.jowfsclient.OwfsException: Error received

On my OpenRemote iPad app, I see N/A for the sensor value, which I have seen in one other thread, but not apparently for the same reason as I have.

There are some instructions which I don't quite understand regarding the use of OWSERVER vs OWFS, and how to configure this properly, and I suspect this may be where I am going wrong.

Any and all pointers or assistance will be gratefully received.

Hugh

I forgot to mention that I'm using the newer ARM Sdk

https://jdk8.java.net/fxarmpreview/index.html

Could this be the problem ? And would I be better advised to use the latest developer release of the controller, rather than 2.0.x, with the newer ARM SDK ?

Posted by scohrab at May 14, 2013 18:05

The 1-Wire Howto is describing everything. The standard install after apt-get normally does not start owserver or it is started so that we cannot attach to it.
We don't need owftp, owread, owfs or anything like that. Just owserver.
An owserver needs to be accessable via network.

Posted by mredeker at May 14, 2013 19:41

Thanks, Marcus. I had installed OWFS via the apt-get method, so I am now wiping the pi and starting again, using the link at the bottom of your page

http://openremote.org/display/docs/OpenRemote+2.0+How+To+-+1-Wire+Sensors

I missed that link before. I guess it might be useful to add the comment there that the apt-get install method for OWFS does not appear to work with OpenRemote ?

Your link points to https://help.ubuntu.com/community/1wireSoftware

so that's what I am trying next.

Thanks for your help. I will let you know how that goes.

Hugh

Posted by scohrab at May 17, 2013 10:13

Hi Marcus,

I've started all over again, using the latest ALPHA Openremote controller V2.1.0_SNAPSHOT-2013-05-11, and the 2.9p0 OWFS installation from Sourceforge, and the java dev version at https://jdk8.java.net/fxarmpreview/. All of this running on the latest Raspbian image, updated with rpi-update and apt-get update and apt-get upgrade.

OWSERVER and OWHTTPD are running OK and producing the normal web pages seen on port 2121. Neither OWFTPD, nor OWFS is ruuning. However, I am still getting exactly the same error as before:-

ERROR [Polling thread for sensor: TestSensor]: OneWire error, unable to read from OWSERVER.
org.owfs.jowfsclient.OwfsException: Error received
        at org.owfs.jowfsclient.internal.OwfsClientImpl.readPacket(OwfsClientImpl.java:576)
        at org.owfs.jowfsclient.internal.OwfsClientImpl.read(OwfsClientImpl.java:314)
        at org.openremote.controller.protocol.onewire.OneWireCommand.read(OneWireCommand.java:139)
        at org.openremote.controller.protocol.onewire.OneWireCommand.run(OneWireCommand.java:219)
        at java.lang.Thread.run(Thread.java:722)

I have also tried stopping the OWHTTPD service, but get the same results. Any idea how I can debug the problem please ?

Regards

Hugh

Posted by scohrab at May 22, 2013 13:20

It must be the way owserver is configured.

How is owserver started? Do you have a file "/etc/init.d/owfs.sh"?
If yes, you can stop the service with "/etc/init.dowfs.sh stop".
After that start owserver manually using this command line: /bin/owserver --device=/dev/ttyUSB0 -p 4304
This would use the 1-Wire stick connected to /dev/ttyUSB0 and listen on incoming connections on port 4304.
Put the IP of your raspberry in hostname for 1-wire protocol and use port 4304.

If this works, you have to change the default startup and config somehow.

Posted by mredeker at May 22, 2013 13:42

Hi Marcus,

I'm starting with an owserver shell script in /etc/init.d, and using an owfs.conf in /etc.

owfs.conf is below, followed by the owserver script. This all came from the original apt-get install, modified for the new 2.9p0 location of OWFS. For hardware, I'm talking to Sheepwalk electronic's RPI3 module, using a busmaster (DS2482-800 chip) approach:-

http://www.sheepwalkelectronics.co.uk/RPI3.shtml

So, could the difference be that I'm not using a serial/USB port ?

I've tried stopping the OWSERVER service using
sudo service owserver stop
followed by
sudo /opt/owfs/bin/owserver --device=/dev/i2c -p 4304

but I just get "Cannot access device /dev/i2c"

Does that help ?

# 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
#
# I2C device: DS2482-100
# If Raspberry Pi version 1
#server: device = /dev/i2c-0
# If Raspberry Pi version 2
server: device = /dev/i2c-1
#
# 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




#!/bin/sh

### BEGIN INIT INFO
# Provides:          owserver
# Required-Start:    $remote_fs $syslog $network $named
# Required-Stop:     $remote_fs $syslog $network $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: 1-wire TCP server
# Description:       Start and stop a TCP server for 1-wire control.
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
CONFFILE=/etc/owfs.conf
DESC="1-Wire TCP Server"
NAME="owserver"
DAEMON=/opt/owfs/bin/$NAME
PIDDIR=/var/run/owfs
PIDFILE=$PIDDIR/$NAME.pid

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

. /lib/lsb/init-functions

d_start() {
    [ -d $PIDDIR ] || {
    mkdir -m 0775 -p $PIDDIR
    chown root:root $PIDDIR >/dev/null 2>&1
    }
    start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- -c $CONFFILE \
        --pid-file $PIDFILE
    # ensure the daemon has been started 
    sleep 1
    pidofproc -p $PIDFILE $DAEMON >/dev/null
}

d_stop() {
    start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
    sleep 1
    if [ -f $PIDFILE ] && ! ps h `cat $PIDFILE` > /dev/null
    then
        # Stale PID file (owserver was successfilly stoped),
        #remove it
        rm -f $PIDFILE
    fi
}

d_status() {
    pidofproc -p $PIDFILE $DAEMON > /dev/null
}

case "$1" in
    start)
        log_daemon_msg "Starting $DESC" "$NAME"
        d_start
        log_end_msg $?
        ;;
    stop)
        log_daemon_msg "Stopping $DESC" "$NAME"
        d_stop
        log_end_msg $?
        ;;
    restart|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME"
        d_status && d_stop
        d_start
        log_end_msg $?
        ;;
    status)
        d_status
        if [ $? -eq 0 ];then
            log_success_msg "$NAME is running"
        else
            log_failure_msg "$NAME is not running"
        fi
        ;;
    *)
        echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|status}" >&2
        exit 1
        ;;
esac

exit 0
Posted by scohrab at May 22, 2013 13:56

Sorry, that paste went a bit wrong

Anywhere I can post the files for you ? Can I make attachments to this forum entry ?

Hugh

Posted by scohrab at May 22, 2013 13:58

Put the pasted code between {code}...{code} tags.
You can also upload files to the forum. It's a bit tricky though.
If owserver is stopped with the service try to use "sudo /opt/owfs/bin/owserver --device=/dev/i2c-1 -p 4304"

Posted by mredeker at May 22, 2013 14:16

Hi Marcus,

OK, I've pasted those two files below between the relevant tags.
I've also stopped the owserver service with:-

sudo service owserver stop

and followed that with

sudo /opt/owfs/bin/owserver --device=/dev/i2c-1 -p 4304

which starts owserver OK, and I see the owhttpd page at port 2121, as expected.

When I then do

./openremote.sh run

I get exactly the same error as before.

My owserver scriupt and owfs.conf follow.

Regards

Hugh

owserver script

#!/bin/sh

### BEGIN INIT INFO
# Provides:          owserver
# Required-Start:    $remote_fs $syslog $network $named
# Required-Stop:     $remote_fs $syslog $network $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: 1-wire TCP server
# Description:       Start and stop a TCP server for 1-wire control.
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
CONFFILE=/etc/owfs.conf
DESC="1-Wire TCP Server"
NAME="owserver"
DAEMON=/opt/owfs/bin/$NAME
PIDDIR=/var/run/owfs
PIDFILE=$PIDDIR/$NAME.pid

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

. /lib/lsb/init-functions

d_start() {
    [ -d $PIDDIR ] || {
    mkdir -m 0775 -p $PIDDIR
    chown root:root $PIDDIR >/dev/null 2>&1
    }
    start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- -c $CONFFILE \
        --pid-file $PIDFILE
    # ensure the daemon has been started 
    sleep 1
    pidofproc -p $PIDFILE $DAEMON >/dev/null
}

d_stop() {
    start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
    sleep 1
    if [ -f $PIDFILE ] && ! ps h `cat $PIDFILE` > /dev/null
    then
        # Stale PID file (owserver was successfilly stoped),
        #remove it
        rm -f $PIDFILE
    fi
}

d_status() {
    pidofproc -p $PIDFILE $DAEMON > /dev/null
}

case "$1" in
    start)
        log_daemon_msg "Starting $DESC" "$NAME"
        d_start
        log_end_msg $?
        ;;
    stop)
        log_daemon_msg "Stopping $DESC" "$NAME"
        d_stop
        log_end_msg $?
        ;;
    restart|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME"
        d_status && d_stop
        d_start
        log_end_msg $?
        ;;
    status)
        d_status
        if [ $? -eq 0 ];then
            log_success_msg "$NAME is running"
        else
            log_failure_msg "$NAME is not running"
        fi
        ;;
    *)
        echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|status}" >&2
        exit 1
        ;;
esac

exit 0

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
#
# I2C device: DS2482-100
# If Raspberry Pi version 1
#server: device = /dev/i2c-0
# If Raspberry Pi version 2
server: device = /dev/i2c-1
#
# 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 = 4304

Posted by scohrab at May 22, 2013 17:02

Next thing I've tried is removing the automatic start of owserver and owhttpd (using update-rc.d remove commands), rebooting the PI, and just running

sudo /opt/owfs/bin/owserver --device=/dev/i2c-1 -p 4304

followed by

sudo /opt/openremote/bin/openremote.sh run

I get the same problem again.

Hugh

Posted by scohrab at May 22, 2013 17:05

Also just tried using the perl module OWNet, with a two line perl program, saved as test.pl:-

use OWNet ;
print OWNet::read( "localhost:4304" , "/26.FFE755010000/temperature" ) ."\n" ;

Then ran

perl test.pl

That returned the same temperature as shown by the web page at port 2121.

Hugh

Posted by scohrab at May 22, 2013 17:21

How does your openremote command look?

Posted by mredeker at May 22, 2013 17:29

Not sure what you mean ?
I start openremote controller with the shell script above (openremote.sh), or did you mean what the Openremote designer Command looks like ?

Posted by scohrab at May 22, 2013 17:51

Yes, the designer.

Posted by mredeker at May 22, 2013 17:56

Name: GetSensorInfo
Protocol: 1-Wire Protocol

Hostname: "MYDNSName" - but this is not visible from the Internet right now
Port: 4304
Device address: /26.FFE755010000
Sensor attribute: temperature
Temp scale: Celsius
Polling interval: 60s

Posted by scohrab at May 22, 2013 17:59

If you run the controller where owserver is running, you also have to use 'localhost' just like your perl script.

Posted by mredeker at May 22, 2013 18:11

Oops. Didn't realise that. I haven't got access to the Pi right now, so I'll try again tomorrow.
Thanks for all the help.Hopefully, that will fix it.

If it does work, I've got a complete step-by-step of installation commands from the most recent Raspbian image,
updating it, installing OWFS, and then OpenRemote that I would be happy to upload somewhere if that helps.

Regards

Hugh

Posted by scohrab at May 22, 2013 18:20

Yes it does help so I can set up a wiki page for that if you want to write it up.

Posted by juha at May 23, 2013 12:22

Hi Marcus,

After changing the 'Host' field in the Designer App to 'localhost', I've got somewhere, but still have the dreaded 'N/A' on the iPad Openremote app.

First time around I did get an error from openremote:-

ERROR [HTTP-Thread-1]: CommandException occurs
org.openremote.controller.config.ControllerXMLChangedException: The content of controller.xml had changed.
followed by lots of lines of 
at xxxxx

After rebooting and re-executing Sync commands from the controller port 8080 web page, that error has now gone away, and I see:-

INFO 2013-05-23 16:13:15,845 : No rule definitions found in '/opt/openremote/webapps/controller/rules'.
INFO 2013-05-23 16:13:15,848 : Initialized event processor : Drools Rule Engine
INFO 2013-05-23 16:13:15,920 : Registered sensor : Level Sensor (Name = 'T1', ID = '11', Min: 0, Max: 100)
INFO 2013-05-23 16:13:15,954 : Startup complete.

So that looks to me like my very simple iPad Designer screen should be working, but I am still getting 'N/A' for the value of that sensor.
I am able to place (and remove) an image on the screen in Designer, and have it appear (and disappear) on the iPad,
so some communication is definitely working.
One other detail - when I select the 'Reload configuration and clear cache' link on the Controller Port 8080 page,
it returns an error message at the top saying 'Failed to reload configuration and clear cache', but if I then press the
'Sync with Online Designer' button, it reports 'Sync Complete'. I have also done the 'Test UI Online' in Designer, and it returns OK.

Any ideas ?

Hugh

Posted by scohrab at May 23, 2013 16:26

Just found the bit about needing a custom sensor for 1-wire temperature, cos of the decimal point. I'll try that tomorrow.

Hugh

Posted by scohrab at May 23, 2013 19:35

Yes, custom sensor is needed. That should help.

Posted by mredeker at May 23, 2013 20:28
Document generated by Confluence on Jun 05, 2016 09:40