sakdavong / openhab

Automatically exported from code.google.com/p/openhab
GNU General Public License v3.0
0 stars 0 forks source link

Add Binding for Velleman K8055 USB IO Board #330

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Velleman produce a USB Input-Output board: Velleman K8055:
http://www.maplin.co.uk/usb-experiment-interface-board-42857

This has 8 digital inputs, 8 outputs and a few analog inputs/outputs

This is an easy and fairly cheap way to add some simple IO to openhab.

A binding for this in OpenHab would be useful.

Original issue reported on code.google.com by AnthonyG...@googlemail.com on 1 Jun 2013 at 6:51

GoogleCodeExporter commented 9 years ago
I have made an initial go at a binding for this board.  This is my openhab 
binding, so probably leaves a little to be desired.  However it seems to work.

See: 
https://code.google.com/r/anthonygreen98-bindings/source/detail?r=b0416e90e58bd7
3f08adb5c5d1a62e130c308e16&name=k8055

== Item Syntax ==
k8055="<IO Type>:<IO Number>"

Where IO Type is one of:
  DIGITAL_IN
  DIGITAL_OUT
  ANALOG_IN
  ANALOG_OUT

And IO Number is the number (1-8) of the particular IO channel to bind to.

== openhab.cfg Config ==

# refresh interval in milliseconds (optional, defaults to 60000ms, 50s)
k8055:refresh=300

# Board Number.  Defaults to 0
k8055:boardno=0

== TODO ==

The binding basically works, but is not well tested.  Still known todos are:

 - Currently only supports a single board.
 - I think the plugin may be causing problems on openhab shutdown (namely, it seems to prevent openhab exiting when I send it a TERM signal)
 - There probably still some issues around startup/shutdown.  e.g. 
    at startup or reconnect the IO states in openhab won't match the hardware until some change occurs.
    I have a suspicion that the background polling thread doesn't always start under some conditions.  (I need to do more testing for that).
 - The binding doesn't currently validate that it types of the items it is bound to are sane.

Any review/comments welcome!

Original comment by AnthonyG...@googlemail.com on 1 Jun 2013 at 7:01

GoogleCodeExporter commented 9 years ago
Also should have mentioned - this binding uses JNA to access an existing native 
code library: http://libk8055.sourceforge.net/  You'll need to have that built 
and installed for the binding to work.  I have tested in Linux, but as the 
Windows DLL Velleman supply has the same API as the Linux lib above it might 
work on windows too.

Original comment by AnthonyG...@googlemail.com on 1 Jun 2013 at 7:07

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
due to lack of time on my side this binding won't make it into 1.3.

Anyhow, thanks for this contribution! We'll start reviewing it soon after the 
upcoming release.

Original comment by teichsta on 6 Sep 2013 at 2:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Did some further testing on I/O Boad with following result: There are different 
I/O Boards on the market K8055/PVM110 and later ones K8055N-1/-2 PVM110N-1; On 
the latest ones the native code library LibK8055 needs to be adjusted. see also 
http://www.forum-raspberrypi.de/Thread-k8055n-2 
My board - PVM11ßN-1 works only with the adjustment. Tried everything and 
linux and works perfect. 
So have compiled jar for K8055.
According to logfile binding starts
20:27:39.089 DEBUG o.o.b.k.i.k8055Activator[:54]- k8055 binding has been 
started.

Definitions in item files are accepted as followed:
/* K8055  */
String input1               "IN1 [%s]"          {k8055="DIGITAL_IN:1"}
Switch output3              "OUT3"              {k8055="DIGITAL_OUT:3"}

Can also see log if I try the switch:
21:09:57.576 INFO  runtime.busevents[:42] - out3 received command ON
21:09:58.322 INFO  runtime.busevents[:42] - out3 received command OFF

However nothing happens on the I/O board and it appears that it is not connected

Guess there is still a problem that K8055 hadware is not found

Tried also adding following argument to the openHAB start script:
-Dgnu.io.rxtx.SerialPorts=/dev/bus/usb/<my_device>

But some -> no result

Original comment by Jk2...@Web.de on 24 Sep 2013 at 9:14

GoogleCodeExporter commented 9 years ago
It can take some fiddling for this to work properly.  First check that "k8055" 
program that comes with the libk8055 library is working on your machine:

If not, it could be either a permissions problem; or the linux kernel loading 
the HID driver and conflicting with libk8055.  I resolved both on my Ubuntu 
machine with a udev rule:

Create file: /etc/udev/rules.d/k8055.rules  with the following contents:
#K8055 
SUBSYSTEM=="usb", ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="5500", 
GROUP="plugdev", MODE="0660", OPTIONS="ignore_device"

Unfortunately the debug output from libk8055 is fairly minimal; so it isn't 
easy to work out why things aren't working from the openhab logs.

Original comment by AnthonyG...@googlemail.com on 7 Oct 2013 at 4:21

GoogleCodeExporter commented 9 years ago
Hi Anthony,
Standalone k8055 program works fine after change in libk8055 as explained in #7 
- see link.
However all trial to access it from openhab failed so far as explained in #7

K8055 start but I do not see a messages that connection is successful. Perhaps 
I have an older source from what you are using; would be great to see an 
update/refresh in snapshot binding soon.

Thanks a lot for your work done so far
k8055 board and openhab would be a great fit if the work finally.

Regards
Jens

Original comment by Jk2...@Web.de on 12 Oct 2013 at 12:18

GoogleCodeExporter commented 9 years ago

Original comment by teichsta on 5 Nov 2013 at 10:47

GoogleCodeExporter commented 9 years ago
This issue has been migrated to Github. If this issue id is greater than103 its 
id has been preserved on Github. You can open your issue by calling the URL 
https://github.com/openhab/openhab/issues/<issueid>. Issues with ids less or 
equal 103 new ids were created.

Original comment by teichsta on 17 Nov 2013 at 8:08

GoogleCodeExporter commented 9 years ago
see above!

Issue has been migrated to Github and should be discussed there.

Original comment by teichsta on 21 Nov 2013 at 1:51