OpenSprinkler PlugIn

V1.0 of a plugin to control OpenSprinkler is now available.

The plugin and instructions can be found at [url=http://code.mios.com/trac/mios_opensprinkler]http://code.mios.com/trac/mios_opensprinkler[/url].

Comments / feedback welcome.

Hello ChrisFSB ,

I’ve had Open Sprinkler running for appx 9 months without any probs. It is awesome standing on its own and I have added automation via scenes in my vera 3 running latest version.

Love the idea of a plugin for added functionality.

I’ve tried to install and I have the “blank” device on my dash but it never seems to populate. Verified IP, rebooted Vera and refreshed GUI to no avail.

Any suggestions?

I got it to work! Had to manually add files. Not self-extract. Took awhile for new zones to populate.

One question, when I try to manually activate a zone via its individual tile while in Auto mode, it spits an invalid password error.

My understanding is that when you run and individual zone via http no P/W is required anyway.

Pretty sure Open Sprinkler logic disallows it as I added luup to the beginning of each of my scene forcing it into manual mode.

If this is the case, seems error is misleading OR do I have some issue with it not recognizing my P/W? It is set to default right now.

Thanks for the great plug-in!

After watching the logs for OSPi while trying to turn a station on with Vera and with the OSPi web interface the issue seems to be your plugin is not setting a time.

Command from OSPi web interface: “sn1=1&t=0”

Command from your Plugin: “sn1=1”

If i start the station from the OSPi web interface I can turn it off from your plugin since the off command of “sn1=0” doesn’t require the time.

Also the station names came across but they don’t show the status of “On” or “Off”. The controller shows the correct state of “Manual” and “Auto”.

I hope this helps.

I was able to get your plugin to turn on the station by replacing line 304 of the I_OpenSprinkler1.xml to this:

local lul_cmd = 'http://' .. luup.devices[luup.device].ip .. '/sn' .. luup.devices[lul_device].id .. '=1&t=0'

Once I turned on the the station the main Controller icon changed and I verified it did turn on the station. Now just need to figure out how to get the stations to show the status. When I turned the station on the controller showed the Manual state and the icon showed something was running but the station didn’t change the icon or show if the station was On or Off.

[quote=“Chris H., post:5, topic:176206”]I was able to get your plugin to turn on the station by replacing line 304 of the I_OpenSprinkler1.xml to this:

local lul_cmd = 'http://' .. luup.devices[luup.device].ip .. '/sn' .. luup.devices[lul_device].id .. '=1&t=0'

Which version of OpenSprinkler firmware are you running? I tested on 1.8.2 where the /t is optional. http://rayshobby.net/?page_id=730#httpget details the HTTP API.

Hmm… that’s curious. The logic is contained in the poll_status function and sets the master status on the basis of one (or more) of the stations running.

For the list of stations being managed did you list them with 01,02,03 etc or 1,2,3? You need the leading 0.

MCV just approved the plugin for download on http://apps.mios.com. There are some improvements that improve error handling. Also would be good for us to debug the latest rev. You’ll need to delete the install you’ve done, then add it from the apps site.

[quote=“fhreid, post:3, topic:176206”]One question, when I try to manually activate a zone via its individual tile while in Auto mode, it spits an invalid password error.
Pretty sure Open Sprinkler logic disallows it as I added luup to the beginning of each of my scene forcing it into manual mode.[/quote]
The error message is misleading (you found a bug). The error should read “Unable to control irrigation zone. Check controller is in Manual Mode”.

As you mentioned, OpenSprinkler doesn’t allow control of a single zone unless the controller is in manual mode.

I installed mine from the app store but I will delete it and install again.

My stations are number “01,02,03,04,05,06”.

I’m using v 1.8.3 for the Raspberry Pi by Dan.

Another note: I can actually turn Stations On and Off while the controller is in Automatic. I get an error message on the Vera Status section but the Station does turn On and Off. I like this feature so I hope it doesn’t go away.

I’ll upgrade to 1.8.3 and retest.

I just tested on 1.8.2. and I get “401 Unauthorized” which explains why you’re getting the check password message. Shame 401 is overused for both bad password and controller being in the wrong mode. Although it seems in 1.8.3 the mode restrictions might have been relaxed.

Back to the original problem of the stations not showing correct status. What’s the output from this command?
http://<IP_OF_OpenSprinkler>/sn0

Uninstalled / Reinstalled and same results. Had to re patch the impl file to be able to turn them on and off again.

http://<ip_of_OSPi>/sn0 results:
while all stations are off: 00000000
while stations 6 is on: 00000100
while stations 1 is on: 10000000

I am only using stations 1-6.

I’m stumped. I have upgraded to 1.8.3 on v1.4s hardware and everything works as per spec. Maybe there is a difference between the http API on non-Pi hardware?

Chris - can you enable debug in I_OpenSprinkler1.xml?

local DEBUG_MODE = true

Post the output from:

tail -f /tmp/log/cmh/LuaUPnP.log  | grep -i OpenSprinkler

I’m interested in lines that look like this:
50 08/06/13 12:41:59.296 luup_log:68: OpenSprinkler: Debug: poll_status: status_code=200 res=00000000 <0x2c537680>
50 08/06/13 12:41:59.297 luup_log:68: OpenSprinkler: Debug: poll_status: Max Stations: 8 <0x2c537680>

Not sure how much you wanted but here is a little focused on lines starting with 50:

50	08/06/13 16:55:30.367	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
50	08/06/13 16:55:30.368	luup_log:101: OpenSprinkler: Debug: poll_status: Max Stations: 24 <0x2f9f7680>
50	08/06/13 16:55:30.371	luup_log:101: OpenSprinkler: Debug: poll_status : Exit <0x2f9f7680>
50	08/06/13 16:55:30.371	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Exit <0x2f9f7680>
50	08/06/13 16:55:32.100	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Enter <0x2f9f7680>
50	08/06/13 16:55:32.101	luup_log:101: OpenSprinkler: Debug: poll_status : Enter : DeviceID: 101 <0x2f9f7680>
50	08/06/13 16:55:32.241	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
50	08/06/13 16:55:32.322	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
50	08/06/13 16:55:32.322	luup_log:101: OpenSprinkler: Debug: poll_status: Max Stations: 24 <0x2f9f7680>
50	08/06/13 16:55:32.325	luup_log:101: OpenSprinkler: Debug: poll_status : Exit <0x2f9f7680>
50	08/06/13 16:55:32.325	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Exit <0x2f9f7680>
50	08/06/13 16:55:34.100	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Enter <0x2f9f7680>
50	08/06/13 16:55:34.101	luup_log:101: OpenSprinkler: Debug: poll_status : Enter : DeviceID: 101 <0x2f9f7680>
50	08/06/13 16:55:34.194	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
0	08/06/13 16:55:34.264	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
50	08/06/13 16:55:34.264	luup_log:101: OpenSprinkler: Debug: poll_status: Max Stations: 24 <0x2f9f7680>
50	08/06/13 16:55:34.267	luup_log:101: OpenSprinkler: Debug: poll_status : Exit <0x2f9f7680>
50	08/06/13 16:55:34.268	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Exit <0x2f9f7680>
50	08/06/13 16:55:36.100	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Enter <0x2f9f7680>
50	08/06/13 16:55:36.101	luup_log:101: OpenSprinkler: Debug: poll_status : Enter : DeviceID: 101 <0x2f9f7680>
50	08/06/13 16:55:36.174	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
0	08/06/13 16:55:36.252	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
50	08/06/13 16:55:36.253	luup_log:101: OpenSprinkler: Debug: poll_status: Max Stations: 24 <0x2f9f7680>
06	08/06/13 16:55:36.253	Device_Variable::m_szValue_set device: 101 service: urn:fowler-cc:serviceId:OpenSprinkler1 variable: Status was: 0 now: 0 #hooks: 0 upnp: 0 v:0xa0ffb8/NONE duplicate:1 <0x2f9f7680>
50	08/06/13 16:55:36.256	luup_log:101: OpenSprinkler: Debug: poll_status : Exit <0x2f9f7680>
50	08/06/13 16:55:36.256	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Exit <0x2f9f7680>
50	08/06/13 16:55:38.100	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Enter <0x2f9f7680>
50	08/06/13 16:55:38.101	luup_log:101: OpenSprinkler: Debug: poll_status : Enter : DeviceID: 101 <0x2f9f7680>
50	08/06/13 16:55:38.176	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
50	08/06/13 16:55:38.244	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
50	08/06/13 16:55:38.244	luup_log:101: OpenSprinkler: Debug: poll_status: Max Stations: 24 <0x2f9f7680>
50	08/06/13 16:55:38.247	luup_log:101: OpenSprinkler: Debug: poll_status : Exit <0x2f9f7680>
50	08/06/13 16:55:38.247	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Exit <0x2f9f7680>
50	08/06/13 16:55:40.100	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Enter <0x2f9f7680>
50	08/06/13 16:55:40.101	luup_log:101: OpenSprinkler: Debug: poll_status : Enter : DeviceID: 101 <0x2f9f7680>
50	08/06/13 16:55:40.259	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
50	08/06/13 16:55:40.330	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
50	08/06/13 16:55:40.330	luup_log:101: OpenSprinkler: Debug: poll_status: Max Stations: 24 <0x2f9f7680>
50	08/06/13 16:55:40.333	luup_log:101: OpenSprinkler: Debug: poll_status : Exit <0x2f9f7680>
50	08/06/13 16:55:40.334	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Exit <0x2f9f7680>
50	08/06/13 16:55:42.100	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Enter <0x2f9f7680>
50	08/06/13 16:55:42.101	luup_log:101: OpenSprinkler: Debug: poll_status : Enter : DeviceID: 101 <0x2f9f7680>
50	08/06/13 16:55:42.176	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>
0	08/06/13 16:55:46.268	luup_log:101: OpenSprinkler: Debug: poll_status : Exit <0x2f9f7680>
50	08/06/13 16:55:46.268	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Exit <0x2f9f7680>
50	08/06/13 16:55:48.100	luup_log:101: OpenSprinkler: Debug: poll_status_cycle : Enter <0x2f9f7680>
50	08/06/13 16:55:48.101	luup_log:101: OpenSprinkler: Debug: poll_status : Enter : DeviceID: 101 <0x2f9f7680>
50	08/06/13 16:55:48.174	luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html>

I hope this helps.

[quote=“Chris H., post:12, topic:176206”] 50 08/06/13 16:55:30.367 luup_log:101: OpenSprinkler: Debug: poll_status: status_code=200 res=<!DOCTYPE html> [/quote]
Thanks Chris. It seems the Pi version is returning something different than the non-Pi version I have.

I would expect to have seen:

50      08/06/13 12:41:57.299   luup_log:68: OpenSprinkler: Debug: poll_status: status_code=200 res=00000000 <0x2c537680>

Can you run:

C:\WGET64.EXE -O sn0.html http://<IP_OPENSPRINKLER>/sn0 

and post the contents of sn0.html?

My guess is that in your firmware version the status page is being returned with html tags; vs. mine which has none.

Alternatively, any chance you can let me access you OpenSprinkler over the Internet? Then I can figure what code changes are needed to accommodate the differences.

Here is the contents for the sn0.htm file using wget:

<!DOCTYPE html>
00000000

I will send you a PM on how to access my OSPi.

Got it - thanks too for the PM (I don’t have priv’s to reply to PM’s; I’ve asked MCV to fix).

I will try to turn around a new version tomorrow which accommodates the html tags in the /sn0 response.

Thank you for the update, Everything is working perfect.

Hi guys,

I stumbled across OpenSprinkler and was reading the posts here on the forums. I am trying to decide whether or not to purchase an OpenSprinkler v2.0 and tie it into my Vera Lite’s z-wave network. Since all of you in this thread already use OpenSprinkler, what are your thoughts on it? Do you guys find it a useful addition to your z-wave network or is it more like a fancy toy add-on that is nice, but you don’t really find a critical component? How well do you find it integrates with Vera? I downloaded the plugin just to see the interface and I see it has ‘off’, ‘manual’ and ‘automatic’. Do you have to set zones solely through the OpenSprinkler web interface or can you also set zones up and make changes through Vera? Thanks for the input.

Personally I like having the ability to control everything from within one interface (Door Locks, Garage Doors, Lights, A/C, Camera’s, Alarm System and now Sprinkler System).

You still have to setup your schedules through the OpenSprinkler web interface, I did install the HTML 5 Version of the interface from Samer Albahra where I do my scheduling, handle rain delays due to weather, view the logs and such. From Vera I can see if the Sprinkler system is running and turn on a station to mess with solicitors as the come up to the front door ;D

Nice! :slight_smile: Thanks for the input, Chris. Do you have the v.2.0?

No - but looking at the OpenSprinkler blog it says the software is basically the same.

Let me know if code changes are needed; with Chris’ issues I accessed his remotely to debug the Pi differences.