Self made Hardware

I am a newbie with openHAB and I have developed my hw board and I want connect it to openHAB.
If I have a proprietary protocolo how I can create my sw interface.
I am a bit confuse with the doc. Anyone can help me with the doc link and a brief explanation of how I can do.
thanks a lot

It would probably be easier and more flexible to convert your proprietary protocol to something openHAB already understands such as TCP sockets, external scripts, HTTP, MQTT, GPIO pins, etc.

Failing that, the How to Implement a Binding wiki page is where you want to look.

Thanks for istant reply!
Uhm…I still have a lot to learn …

Ok, if I use a serial port with my proprietary protocol I must create my binding but I think isn’t the most straightforward solution…

If I use the eth port with TCP socket where I have to declare the message structure ?
For example: field offset 4 byte in my data is the room temperature integer 16bit format

You would create an Item bound to the Serial binding to read your messages and write a rule to parse your data and populate your Items.

You would create an Item bound to the TCP binding to read the data off of the socket and then write a rule to parse the data read and populate your Items.

The advantage of doing this in rules as opposed to writing your own binding is that as openHAB continues to grow and when openHAB 2 is released your code will still work. If you write your own binding you will have to keep up with changes to openHAB.

However, working with binary data in Java and by extension openHAB rules is pretty clunky, I personally would probably write something in Python (or your language of choice) and, if openHAB polls for the messages, have openHAB call the Python script using the Exec binding. If the data comes in on a stream I would write a Python (or your language of choice) service that reads and parses your proprietary protocol and pushes them to openHAB. I personally would use MQTT but there are other approaches.

Oh! I understand (I hope…)

1.- define the item like this (for serial port)

String My_Board_Data "My_Label" {serial=COMsomething}

2.- define the rule

var String rx_buffer = ""

    rule "My_Board_Send_Data"
    	when 
    		Item My_Board_Data received update
    	then
           rx_buffer += My_Board_Data  (here I am not sure...)

Uff! I work in the “cellar of the PC” with micro/fpga/interrupt… and when I get to the upper floors I am in trouble…

I have MQTT client working with socket or websocket on my board but openHAB need a broker I think (…added to the list of things to be studied…)

Mosquitto broker for MQTT

It wok! It work! (But is only the first step )

How configure serial port
I am working in windows (XP) and for test I use the openaHAB demo sitemap default installed

1.- File start.bat (or start_debug.bat) (ROOT directory)
Add the option -Dgnu.io.rxtx.SerialPorts=COM11 (see te code row below)

java %DEBUG_OPTS% -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dgnu.io.rxtx.SerialPorts=COM11 -Djetty.port=%HTTP_PORT% -Djetty.port.ssl=%HTTPS_PORT% -Djetty.home=. -Dlogback.configurationFile=configurations/logback_debug.xml -Dfelix.fileinstall.dir=addons -Djava.library.path=lib -Dorg.quartz.properties=./etc/quartz.properties -Djava.security.auth.login.config=./etc/login.conf -Dequinox.ds.block_timeout=240000 -Dequinox.scr.waitTimeOnBlock=60000 -Dfelix.fileinstall.active.level=4 -Djava.awt.headless=true -jar %EQUINOXJAR% %* -console 

2.- File openhab.cfg (CONFIGURATIONS directory)
Add the serial port (My example set COM11 - MUST be changed with the COM port used)

serial:serialPort="COM11"

3.- copy file
org.openhab.binding.serial-1.6.2.jar form ADDONS_ARCHIVE directory to ADDONS directory
(1.6.2 I think is the version and can’t be always the same)

4.- File demo.items (CONFIGURATIONS/ITEMS driectory)
add the item for serial port

String Myserial_Buffer "Serial_buffer"  {serial="COM11"}

5.- file demo.rules (CONFIGURATIONS/RULES driectory)
add the rule for the item (here my example

rule "Serial_port"
when 
  Item Myserial_Buffer received update
then
  logInfo("Myserial_Buffer",">>>>>>>> HELLO")
end

Start openhab server (debug mode) and check the log file (LOGS directory)

16:55:16.968 [DEBUG] [i.internal.GenericItemProvider:334  ] - Start processing binding configuration of Item 'Myserial_Buffer (Type=StringItem, State=Uninitialized)' with 'SerialBinding' reader.
16:55:17.109 [DEBUG] [b.serial.internal.SerialDevice:105  ] - Serial port 'COM11' has been found.

if serial fail an error message is displayed

When I send some data to serial port log file add this info (I pressed the ‘f’ key on remote side)

16:55:27.578 [DEBUG] [b.serial.internal.SerialDevice:194  ] - Received message 'f' on serial port COM11
16:55:27.578 [DEBUG] [m.r.internal.engine.RuleEngine:285  ] - Executing rule 'Serial_port'
16:55:27.640 [DEBUG] [m.r.internal.engine.RuleEngine:285  ] - Executing rule 'Timer Demo'
16:55:27.718 [INFO ] [o.model.script.Myserial_Buffer:53   ] - >>>>>>>> HELLO

While the events.log add this

2015-10-23 16:55:27 - Myserial_Buffer state updated to f

Now the ethernet…

Thanks bob but my board is developed with ST micro without an operating system
I am working on MQTT server (minimal…)

try to look to instructables for http://www.instructables.com/id/Uber-Home-Automation-w-Arduino-Pi/ i dont know which platform you use but there is almost everything you have to know.