Hi all,
I finally got my OpenSprinkler Pi, and after (unfortunately) blowing magic smoke out of one of the triacs by connecting up the wrong type of valve (I'm a software engineer, not an electronics expert!), I've finally managed to get OpenHAB to control a water valve via the OpenSprinkler Pi. I've now pushed the code for my binding into a clone of the openhab repo. The changes are all in two changesets:
http://code.google.com/r/jonathan-opensprinklerpi/source/detail?r=00d0248ebe8b493ca02e472016a1a08a01832ec0http://code.google.com/r/jonathan-opensprinklerpi/source/detail?r=28e9c2550f99c97abe143fd579dc0e7486847ceeI am more than happy to see this binding integrated into OpenHAB, if it is desired. Whilst I have been involved in open source projects before, I've never used google code, so please let me know how to proceed. So far no documentation exists but I am happy to write wiki documentation, if someone can point me to the process of doing so.
In short, this binding is intended to be used with an OpenSprinkler Pi board, with OpenHAB running on the connected Raspberry Pi. It is very simplistic - you can configure the number of stations available (by default there are 8, but OpenSprinkler allows for expansion boards). You then create your switch items with a property for each item simply being a value representing which station the switch is to open/close. On my system, because I blew up the first triac (that is, station #0), I have my one valve connected into station #1, so I have an items line like this:
Switch Water_Tank_Fill "Water Tank Filling" { openSprinklerPi="1" }
I then have a switch in the sitemap (as well as rules) that can turn this switch on or off. When this happens the simple code I wrote writes the correct data out over the GPIO pins to the OpenSprinkler Pi, and the valve opens or shuts. To allow the Raspberry Pi to talk over its GPIO pins to the OpenSprinkler Pi, I have a dependency on Pi4J, a library that basically makes available the GPIO pins for Java developers.
There is probably more that can be done. At present there is no support for reading the current state of the valve, so at startup I assume everything is off (and in fact I turn everything off). I am happy to collaborate with others, but my thinking is that we should probably first consider whether this binding should be moved into the official repo or not.
Thanks,
Jonathan