[SOLVED] Does not exist /dev/ttyAMA0

Hi,
I have been trying to get OH1.8 working with my RaspberryPi and Razberry.
Zway worked when it was installed from a previous attempt.

  • ls /dev shows /dev/ttyAMA0

  • This is the second clean install I’ve attempted using the apt-get method.

  • Addon installed - sudo apt-get install openhab-addon-binding-zwave

  • I’ve sudo usermod -a -G dialout openhab ; rebooted

The log at start up is simple… The device does not exist. It does.

2016-01-19 19:44:41.445 [INFO ] [.z.internal.ZWaveActiveBinding] - Update config, port = /dev/ttyAMA0
2016-01-19 19:44:41.487 [INFO ] [.service.AbstractActiveService] - ZWave Refresh Service has been started
2016-01-19 19:44:41.787 [INFO ] [b.z.i.protocol.ZWaveController] - Starting Z-Wave controller
2016-01-19 19:44:41.796 [INFO ] [b.z.i.protocol.ZWaveController] - Z-Wave timeout is set to 5000ms. Soft reset is false.
2016-01-19 19:44:41.803 [INFO ] [b.z.i.protocol.ZWaveController] - Connecting to serial port /dev/ttyAMA0
2016-01-19 19:44:42.213 [ERROR] [b.z.i.protocol.ZWaveController] - Serial Error: Port /dev/ttyAMA0 does not exist
2016-01-19 19:44:46.497 [INFO ] [.service.AbstractActiveService] - ZWave Refresh Service has been shut down
pi@raspberrypi:/etc/openhab $

What am I doing wrong?

This is a very common question - the answer is normally related to the permissions that the user has and whether or not they can access the ports…

There are suggestions to start openhab as root using start.sh but start.sh does not exist when using the apt-get install method.

There was another suggestion to edit line 5 of /etc/default/openhab .
The comments in that file say if there is no parameter on line 5, then they system will use root:root
this is not the case, it still runs as openhab
Modifying line 5 to be root:root will not launch openhab

Thanks for the help.

This is the Startup script I use in my Ubuntu Server. I think it should also work for the Raspberry.

Take a look at the DAEMON_ARGS on line 56 and see how it sets the USB port of my zwave device?

#!/bin/sh

### BEGIN INIT INFO

# Provides:          openhab

# Required-Start:    $remote_fs $syslog

# Required-Stop:     $remote_fs $syslog

# Default-Start:     2 3 4 5

# Default-Stop:      0 1 6

# Short-Description: OpenHAB Daemon

# Description: Build your smart home in no time!

### END INIT INFO


ROOT_DIR=/opt/openhab


# set path to eclipse folder. If local folder, use '.'; otherwise, use /path/to/eclipse/

eclipsehome="$ROOT_DIR/server";


# set ports for HTTP(S) server

HTTP_PORT=8080

HTTPS_PORT=8443


# get path to equinox jar inside $eclipsehome folder

cp=$(find $eclipsehome -name "org.eclipse.equinox.launcher_*.jar" | sort | tail -1);



# This next line determines what user the script runs as.

# Root generally not recommended but necessary if you are using the Raspberry Pi GPIO from Python.

#USER=root

DAEMON_USER=root

DAEMON_NAME=openhab


DAEMON=/usr/bin/java

DAEMON_ARGS="-Djna.boot.library.path=/usr/lib/jni -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0 -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.port=$HTTP_PORT -Djetty.port.ssl=$HTTPS_PORT -Djetty.home=. -Dlogback.configurationFile=configurations/logback.xml -Dfelix.fileinstall.dir=addons -Djava.library.path=lib -Djava.security.auth.login.config=./etc/login.conf -Dorg.quartz.properties=./etc/quartz.properties -Dequinox.ds.block_timeout=240000 -Dequinox.scr.waitTimeOnBlock=60000 -Dfelix.fileinstall.active.level=4 -Djava.awt.headless=true -jar $cp $* -console "

PIDFILE=/var/run/$DAEMON_NAME.pid


. /lib/lsb/init-functions

 

do_start() {        

	log_daemon_msg "Starting system $DAEMON_NAME daemon"

	start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --chdir $ROOT_DIR --exec $DAEMON -- $DAEMON_ARGS

	log_end_msg $?

}

do_stop() {

	log_daemon_msg "Stopping system $DAEMON_NAME daemon"

	start-stop-daemon --stop --pidfile $PIDFILE --retry 10

	log_end_msg $?

}

 

case "$1" in

 

    start|stop)

        do_${1}

        ;;

 

    restart|reload|force-reload)

        do_stop

        do_start

        ;;

 

    status)

        status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?

        ;;

    *)

        echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"

        exit 1

        ;;

 

esac

exit 0

FIXED!!!

ls -l /dev/ttyAMA0 shows

pi@raspberrypi:/etc/default $ sudo ls -l /dev/ttyAMA0
crw–w---- 1 root tty 204, 64 Jan 19 19:38 /dev/ttyAMA0

It says “tty” group, so I modified the command to grant openhab to tty instead of dialout

sudo usermod -a -G tty openhab

Now I am out of diskspace using 4GB SD card and Raspian Jessie Full Desktop.
At least I am past this hurdle!!!