Serial Binding instructions

1,876 views
Skip to first unread message

Ammad

unread,
Feb 11, 2015, 4:41:36 AM2/11/15
to ope...@googlegroups.com
Hi!
Very warm greeting to Kai and everyone contributing and working on OpenHab!
  1. I am using Windows7 (64-bit) and had setup OpenHab following this: https://github.com/openhab/openhab/wiki/Windows
  2. added demo configuration in the directory accordingly, and addons.
  3. installed Eclipse Smart Home, and opened demo configuration folder path inside it located
  4. then followed this https://github.com/openhab/openhab/wiki/Serial-Binding for serial binding, and modified my demo.items file accordingly.
  5. creating a copy of openhab_default.cfg to openhab.cfg and edited it for serial port binding as  serial="COM5" 
  6. then used USB to serial cable to monitor the messages generated ob OpenHab using a COM port scanner utility and cross cable.
Still not able to get any message on my COM port:
Kindly suggest me the .cfg settings and what else i need to setup for getting events weather update and device On/Off statuses on my serial port.

Thanks!

Ammad

Kai Kreuzer

unread,
Feb 11, 2015, 6:38:52 AM2/11/15
to ope...@googlegroups.com
Hi Ammad,

I cannot directly help you on your project, but I just want to mention that as you are using openHAB 1, you should NOT use the Eclipse SmartHome Designer in step 3, but rather use the Designer from http://www.openhab.org/downloads.html

Another question: Did you add the serial binding in your addons folder as well?

Regards,
Kai

--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
To view this discussion on the web visit https://groups.google.com/d/msgid/openhab/119878b1-1f88-4de8-a672-7c53fbbd1d9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Doug Meredith

unread,
Feb 11, 2015, 6:39:57 AM2/11/15
to ope...@googlegroups.com

I don't have any answer to your core question, but a couple of points....

What version of openHAB are you running? I don't know what the procedure is for installing openHAB 2, but for openHAB 1, I don't think installing Eclipse Smart Home is meaningful.

You don't need to make a copy of the default configuration file as it is always read. You can just start with an empty openhab.cfg.

Ammad

unread,
Feb 11, 2015, 6:55:58 AM2/11/15
to ope...@googlegroups.com
Thanks Kia for your reply.
i'll be using Designer from http://www.openhab.org/downloads.html in future
Yes! i added the serial binding in my addons folder.

Ammad

unread,
Feb 11, 2015, 7:24:06 AM2/11/15
to ope...@googlegroups.com
Thanks Doug for your reply.
i am using Version 1.6
i made the following changes:
  1. -Dgnu.io.rxtx.SerialPorts=COM5         ----> added in batch file soon after where inverted commas ends in this string "java -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true " 
  2. serial="COM5"    ----> in openhab.cfg file and 
  3. Switch Light_C_Corridor_Ceiling "Ceiling" (gC, Lights)      { serial="COM5" }    ----> in demo.items
  4. adding serial binding org.openhab.binding.serial jar file  file in my addons folder
  5. restarted OpenHab.
  6. result: no data on serial port.
Kindly guide me, where i made mistake and what i skipped.

Ammad

unread,
Feb 12, 2015, 5:23:53 AM2/12/15
to ope...@googlegroups.com
80      Active          org.openhab.persistence.exec                    org.openhab.persistence.exec(bid=227)
81      Active          org.openhab.binding.serial                      org.openhab.binding.serial(bid=228)
82      Active          org.openhab.persistence.rrd4j                   org.openhab.persistence.rrd4j(bid=229)
83      Active          org.openhab.persistence.rrd4j.chartservlet                      org.openhab.persistence.rrd4j(bid=229)
osgi>
osgi> stop 228
osgi>
osgi> start 228
15:06:08.991 ERROR o.o.m.i.i.GenericItemProvider[:343] - Binding configuration of type 'serial' of item æSwitch Light_C_Corridor_Ceilingæ could not be parsed correctly.
org.openhab.model.item.binding.BindingConfigParseException: Could not open serial port COM5: gnu.io.PortInUseException: openHAB
        at org.openhab.binding.serial.internal.SerialBinding.processBindingConfiguration(SerialBinding.java:118)

ge...@ge-volution.eu

unread,
Feb 12, 2015, 5:26:25 AM2/12/15
to ope...@googlegroups.com
You are talking about "data on serial port" however are also using the Switch item type.  If you are looking to read data from the serial port then you need to use the String item type and then put some parsing rules/scripts together in order to work with the incoming data and mangle it into the format that you want.  Here is an example from on Google...

http://forum.mysensors.org/uploads/upload-4c59ef4c-9c49-475d-815c-7d4f07443eb6.rules

If you use the Switch item type, then it will just flip back and forth from ON/OFF when there is data on the wire.

You should also watch the log files, as the openhab.log file will show you if there are errors with your binding or item definition, and the events.log will show you when the items are being updated (receiving events).

Greg

Ammad

unread,
Feb 12, 2015, 6:26:29 AM2/12/15
to ope...@googlegroups.com
Thank you very much Greg for identifying the real problem.

I am going to use Raspberry Pi on which OpenHab will be running and a micro-controller will be connected to Pi with Rx and Tx wire. and I/O pins of micro-controller are connected with LEDs (depicting as home appliances) but right now i am working on windows for little convenience.
I had just started working on OpenHab few days ago. Following the OpenHab wiki from start.
  1. Are their any video tutorials or book (e.g. OpenHab guide for dummies etc) which could help out? i had searched on youtube but couldn't find.
  2. Moreover, what steps i need to do; to make this project, a reality. i'll code myself, just tell me what modification would be needed to do with items, rules, cfg, scripts etc. i got understanding of sitemap but still confused about binding of appliances with OpenHab.
Very warm Thanks!
Best Regards:
Ammad

Ammad

unread,
Feb 12, 2015, 8:09:04 AM2/12/15
to ope...@googlegroups.com
Hi everyone again! 
osgi> 17:53:23.429 WARN  o.o.c.core.ConfigDispatcher[:236] - Cannot parse line 'serial="COM5"' of main configuration file 'configurations\openhab.cfg'

Generic Item Binding Configuration

In order to bind an item to a Serial device, you need to provide configuration settings. The easiest way to do so is to add some binding information in your item file (in the folder configurations/items`).

The format of the binding configuration is simple and looks like this:

serial="<port>"

where <port> is the identification of the serial port on the host system, e.g. "COM1" on Windows, "/dev/ttyS0" on Linux or "/dev/tty.PL2303-0000103D" on Mac.

Kind Regards:
Ammad

On Wednesday, February 11, 2015 at 4:38:52 PM UTC+5, Kai Kreuzer wrote:

Greg Eva

unread,
Feb 12, 2015, 11:10:59 AM2/12/15
to ope...@googlegroups.com
Hi Ammad,

I guessed that if you were talking about serial comms you probably wanted string data. :-P

In regards to guides that you are looking for, it is very hard for anyone to give you direction when you have not described what it is you are trying to do and with what tools you are working.

As for your COM5 problem, are you sure that this is the correct COM port and that it is not currently in-use by another program, like Hyperterminal or something?

Greg

--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/xryThUSOe4o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.

Oliver Mathes

unread,
Apr 8, 2015, 11:49:57 AM4/8/15
to ope...@googlegroups.com
Hi Ammad,

As far as I know, you don't need to put any configuration string into the openhab.cfg file for the serial binding. My entry in the item file, the one in the items folder, lokks like the following:

String SerialText                "Serial Data [%s]"    <serial> { serial="/dev/ttyUSB0" }

And this works on RaspPi

Greetings
Oliver
Reply all
Reply to author
Forward
0 new messages