Hi,
I’m trying to connect an arduino via Serial Protocol(Serialbinding 1.7.1) to openhab 1.7.1, running on raspberry pi (Linux raspberrypi 4.1.6+ #810 PREEMPT Tue Aug 18 15:19:58 BST 2015 armv6l GNU/Linux). But the connection fails with following exception:
Binding configuration of type ‘serial’ of item ‘Arduino‘ could not be parsed correctly.
org.openhab.model.item.binding.BindingConfigParseException: Could not open serial port /dev/ttyUSB0: Serial port ‘/dev/ttyUSB0’ could not be found. Available ports are:
at org.openhab.binding.serial.internal.SerialBinding.processBindingConfiguration(SerialBinding.java:129) ~[na:na]
at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:348) [org.openhab.model.item_1.7.1.jar:na]
at org.openhab.model.item.internal.GenericItemProvider.dispatchBindingsPerType(GenericItemProvider.java:309) [org.openhab.model.item_1.7.1.jar:na]
at org.openhab.model.item.internal.GenericItemProvider.addBindingConfigReader(GenericItemProvider.java:106) [org.openhab.model.item_1.7.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0]
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0]
at org.eclipse.equinox.internal.ds.model.ComponentReference.bind(ComponentReference.java:376) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bindReference(ServiceComponentProp.java:444) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.InstanceProcess.dynamicBind(InstanceProcess.java:416) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:334) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433) [org.eclipse.osgi_3.8.2.v20130124-134944.jar:na]
at org.eclipse.equinox.internal.ds.InstanceProcess.registerService(InstanceProcess.java:536) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:260) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:473) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:217) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:816) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:783) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89) [org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar:na]
at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70) [org.eclipse.equinox.util_1.0.400.v20120917-192807.jar:na]
I already added the java argument to the openhab start script in init.d and openhab/bin/ folder like so:
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
DEBUG_ARGS="-Xdebug \
-Xnoagent \
-Djava.compiler=NONE \
-Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n \
-Dlogback.configurationFile=${OPENHAB_CONF_DIR}/logback_debug.xml"
JAVA_ARGS_DEFAULT="-Dosgi.clean=true \
-Declipse.ignoreApp=true \
-Dosgi.noShutdown=true \
-Djetty.port=${HTTP_PORT} \
-Dopenhab.configfile="${OPENHAB_CONF_DIR}/configurations/openhab.cfg" \
-Dopenhab.configdir="${OPENHAB_CONF_DIR}/configurations" \
-Dopenhab.logdir="${OPENHAB_LOG_DIR}" \
-Dsmarthome.userdata="${OPENHAB_USER_DATA_DIR}"
-Djetty.home="${OPENHAB_DIR}" \
-Djetty.port.ssl=${HTTPS_PORT} \
-Djetty.config="${OPENHAB_CONF_DIR}/jetty" \
-Djetty.logs="${OPENHAB_LOG_DIR}" \
-Djetty.rundir="${OPENHAB_DIR}" \
-Dfelix.fileinstall.dir="${OPENHAB_DIR}/addons" \
-Dfelix.fileinstall.filter=.*\\.jar \
-Djava.library.path="${OPENHAB_DIR}/lib" \
-Djava.security.auth.login.config="${OPENHAB_CONF_DIR}/login.conf" \
-Dorg.quartz.properties="${OPENHAB_CONF_DIR}/quartz.properties" \
-Dequinox.ds.block_timeout=240000 \
-Dequinox.scr.waitTimeOnBlock=60000 \
-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0\
-Dfelix.fileinstall.active.level=4 \
-Djava.awt.headless=true \
-jar ${LAUNCHER} \
-configuration ${OPENHAB_WORKSPACE_DIR} \
-data ${OPENHAB_WORKSPACE_DIR} \
-console ${TELNET_PORT}"
if [ x"${JAVA_ARGS}" != x ]; then
JAVA_ARGS_DEFAULT="${JAVA_ARGS} ${JAVA_ARGS_DEFAULT}"
fi
if [ x"${OPENHAB_ARGS}" != x ]; then
JAVA_ARGS_DEFAULT="${JAVA_ARGS_DEFAULT} ${OPENHAB_ARGS}"
fi
if echo ${DEBUG} | grep -qi "^yes$"; then
JAVA_ARGS_DEFAULT="${DEBUG_ARGS} ${JAVA_ARGS_DEFAULT}"
else
JAVA_ARGS_DEFAULT="-Dlogback.configurationFile=${OPENHAB_CONF_DIR}/logback.xml ${JAVA_ARGS_DEFAULT}"
fi
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
${OPENHAB_INST_DIR}/bin/setpermissions.sh > /dev/null
if start-stop-daemon --start --quiet --pidfile $PIDFILE $EXTRA_ARGS \
--oknodo --exec $JAVA -- $JAVA_ARGS_DEFAULT
then
log_end_msg 0
else
log_end_msg 1
fi
;;
by the way: which way is right?
-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0\ or -Dgnu.io.rxtx.SerialPorts="/dev/ttyUSB0"
Nevertheless non of these ways worked for me.
items document:
String Arduino "Arduino" { serial="/dev/ttyUSB0@115200" }
Number livingTemp01 "Temperatur [%.1f °C]" <temperature> (Temperature,GF_Living)
Accessing to /dev/ttyUSB0, by for example screen, works without any problems.
EDIT:
When I start openhab with the start.sh file, it works without any problems.
So what’s different to the /init.d/openhab startup file?
The User? openhab vs root?
Can anybody help?
Thank you!