OpenSprinkler Pi Binding

563 views
Skip to first unread message

Jonathan Giles

unread,
Aug 2, 2013, 10:43:08 PM8/2/13
to ope...@googlegroups.com
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=00d0248ebe8b493ca02e472016a1a08a01832ec0
http://code.google.com/r/jonathan-opensprinklerpi/source/detail?r=28e9c2550f99c97abe143fd579dc0e7486847cee

I 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

Karel Goderis

unread,
Aug 3, 2013, 2:46:48 AM8/3/13
to ope...@googlegroups.com
+1

I was also looking to opensprinkler as u need a similar solution for my garden. The commercial solutions from companies like Gardena are good in terms of piping, sprinkler but limited in terms of control.

K

Sent from my iPhone
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Karel Goderis

unread,
Aug 3, 2013, 3:15:24 AM8/3/13
to ope...@googlegroups.com
Jonothan,

Cfr your problem to detect on/off initial state, what I intend to put in my installation is a KNX-based water counter (from arcus-eds) at the entry point of the sprinkler system, so that it is possible to detect if any state is "wrong" (e.g. water flowing)....

Karel

On 03 Aug 2013, at 04:43, Jonathan Giles <jona...@jonathangiles.net> wrote:

Jonathan Giles

unread,
Aug 3, 2013, 3:19:42 AM8/3/13
to ope...@googlegroups.com
This is one possible solution, but in reality there is a much easier solution: just read back the state of the shift registers on the OpenSprinkler Pi. The only reason why I haven't done this yet is because it isn't an urgent requirement for me right now. If it is something that is urgent for someone else, this would be my recommended approach. I can also work on it if anyone wants.

-- Jonathan

Karel Goderis

unread,
Aug 3, 2013, 3:29:56 AM8/3/13
to ope...@googlegroups.com
Ok - I understood from your first post that it was not possible to read back the state. Obviously that is more reliable. I intend to put in pulsecounter just for security reasons (leaks, abuse by the children,...) anyways.

Jonathan Giles

unread,
Aug 3, 2013, 3:39:33 AM8/3/13
to ope...@googlegroups.com
Unfortunately it looks like this might be the case - the OpenSprinkler Pi does not appear to allow reading back the shift register state (which is slightly odd, but I'm not enough of a electrical guru to want to write the software to test it out, unless someone wants to sponsor me for a OpenSprinkler Pi if my one explodes!). Here's what I just read: http://rayshobby.net/phpBB3/viewtopic.php?f=28&t=228&start=10#p1504

-- Jonathan

Thomas Eichstädt-Engelen

unread,
Aug 4, 2013, 2:46:14 PM8/4/13
to ope...@googlegroups.com
Hi Jonathan,

great news! Good to know that openHAB has just started in the gardening business ;-)

I 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. 

Since there exists no issue for the OpenSprinkler please a new issue for it. We will use this issue to post the review result and discuss further implementation details. Furthermore it helps to help us create comprehensive release notes. Next i will start reviewing your code and merge it to the main repo after successful review. Meanwhile you should create a Wiki page containing detailed information regarding your binding. See binding section for examples.

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.

We would be happy to move the code after the review.

Thanks again Jonathan for you contribution,

Thomas E.-E.


Jonathan Giles

unread,
Aug 4, 2013, 4:57:54 PM8/4/13
to ope...@googlegroups.com


great news! Good to know that openHAB has just started in the gardening business ;-)

More than just the gardening business - any business where the OpenSprinkler Pi can come in handy :-) My use case is not even related to watering my garden, rather it is to fill up my home water tank from an external (but very slow flowing) water source.

I 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. 

Since there exists no issue for the OpenSprinkler please a new issue for it. We will use this issue to post the review result and discuss further implementation details. Furthermore it helps to help us create comprehensive release notes. Next i will start reviewing your code and merge it to the main repo after successful review. Meanwhile you should create a Wiki page containing detailed information regarding your binding. See binding section for examples.

I have filed a feature request here: http://code.google.com/p/openhab/issues/detail?id=392
I will get started on a wiki summary ASAP.

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.

We would be happy to move the code after the review.

Thanks again Jonathan for you contribution,

No problem - happy to contribute. I've been in plenty of open source projects, but this is the first in the long time where I wasn't the leader, so it is a nice change :-)

-- Jonathan
Reply all
Reply to author
Forward
0 new messages