OpenSprinkler Plugin Update for firmware 2.1.3+

**** Update 03/01/2015 ****
OpenSprinkler just released their unified firmware 2.1.3 which means that the API should now be stabilized between the regular OS, the OSPi, and the OSBBB. They also added hashed md5 passwords to the API.

The files that are attached here are now only compatible with firmware 2.1.3 and above. They should work now no matter what version of the OS you have as long as you can run firmware 2.1.3.

*************************

Based on the discussion here, I’m posting some updated files for the OpenSprinkler plugin to allow it to work with the latest firmware (mine is running 2.1.2). This is a rough beta, but appears to be doing what it should. The instructions I’m going to give below are for UI5 because that’s what I use. I can’t really answer any questions on UI7 installation.

The first step is to install the current OpenSprinkler plugin from the app store if you haven’t already. The files I’m putting here are just updates to the existing files so there’s no formal install for them yet.

Next you should backup the files that we are about to overwrite. Go to Apps->Develop Apps->Luup Files and download the following three files:
I_OpenSprinkler1.xml
D_OpenSprinkler1.json
D_OpenSprinkler1_UI7.json

Save them somewhere so you can restore them later if necessary.

Because the new firmware for OS returns everything in JSON, I opted to use akbooer’s JSON parser library. You will need to install this to /usr/lib/lua (usually done via scp or sftp). If you use any of akbooer’s other programs/plugins, you may have it installed already. You can get the file from here. That’s the official thread for the parser and the latest version will be available there.

Once those steps are done, you are ready to upload my updated versions of the three files you backed up above (you did back them up, right?)

Using the same Apps->Develop Apps->Luup Files screen, browse for my copy of the three files attached here so they show up in the right hand side of that screen, ready for upload. Check the “Restart Luup after upload” check box and hit the “Go” button. Vera will restart the luup engine.

In order to see the UI changes, you might need to refresh the vera page in your browser, or maybe even clear your browser cache and reload. When it’s working right, the main OpenSprinkler controller device will only have “Disable” and “Enable” buttons next to each other instead of “Off”, “Manual”, and “Auto” in one column.

Debugging is turned on, so there will probably be lots of feedback in the logs which could be helpful to me if you see any issues.

Configuration is pretty much the same as for the old plugin. You can look at the original thread for more info. I’ve added one new variable called ManualMaxMinutes which by default is set to 1. If you want to control the valves manually with vera, then set this to some number that is probably more realistic. The valves will run no longer than this amount when you turn them on manually. I had to do this because the new API requires a time be passed in when turning on a valve manually. You can always still turn them off early, however.

I have been using 20 seconds for the status update time as opposed to the default 2 seconds. That seems plenty for me and cuts down on some network traffic and vera overhead.

So, give it a whirl and see how it goes. Let me know of any issues or other features you might like to see.

So I had some free time and thought I would give this a try. So far no luck. Here’s what I’ve done:

I checked to make sure that dkjson.lua was in /usr/lib/lua (I had EventWatcher loaded)
I backed up the files you directed. I uploaded your new files and set the lua engine to restart
I cleared the cache in Chrome

When I look at the OpenSprinkler device I now see enable and disable instead of the auto/manual/off
I don’t see your new variable in the advanced tab of the device??

Nothing seems to actually do anything but there are no errors generated

Any troubleshooting tips? I’m happy to be a beta tester. I have a Vera 3 running UI5 and another test Vera 3 running UI7 (both seem to be the same)
My OpenSprinkler is a OSPi unit that is now running the 2.2.2 software (I tried a git and that’s what loaded). It says it’s from 1-13-15 so really new. It may have broken what you tried to do.

Let me know if I can help.

[quote=“xuniman, post:2, topic:185261”]So I had some free time and thought I would give this a try. So far no luck. Here’s what I’ve done:

I checked to make sure that dkjson.lua was in /usr/lib/lua (I had EventWatcher loaded)
I backed up the files you directed. I uploaded your new files and set the lua engine to restart
I cleared the cache in Chrome

When I look at the OpenSprinkler device I now see enable and disable instead of the auto/manual/off
I don’t see your new variable in the advanced tab of the device??

Nothing seems to actually do anything but there are no errors generated

Any troubleshooting tips? I’m happy to be a beta tester. I have a Vera 3 running UI5 and another test Vera 3 running UI7 (both seem to be the same)
My OpenSprinkler is a OSPi unit that is now running the 2.2.2 software (I tried a git and that’s what loaded). It says it’s from 1-13-15 so really new. It may have broken what you tried to do.

Let me know if I can help.[/quote]

Thanks for the info. So, for the firmware, you used their firmware upgrade tool and the version it gave you was 2.2.2? Did it say that was a beta or anything?

Did you set your zones in the ZoneIds variable, and if so, do you see the child devices being created for those?

Are you able to ssh to your vera unit? If so, you could pull some info from the logs and it might tell us more about what’s happening. Let me know if you can ssh in and I’ll tell you what I need you to do. I can also try and install the 2.2.2 update and see if I encounter any issues. I’m guessing they might have made some change between the 2.1 → 2.2. But if I do that, it will probably be a few days before I can get to it.

Bruce

I just downloaded the firmware update tool from OpenSprinkler. My hardware appears to be the latest, 2.2 and the latest firmware it offered me was 2.1.2 which is what I already have. I’m using the standard AVR based version though.

It looks like the OSPi uses a completely different way of updating software and I wouldn’t be surprised if the versions don’t match. The key is whether the API is consistent across versions of OS. I will write Ray and ask about this.

Bruce

I talked to Samer at OS support via e-mail. It appears there are some differences in the API between the OSPi and the Arduino based units. The firmware for the OSPi is user contributed and developer updated, so while they strive to have API compatibility, there are some things that are different. He offered to send me the list of things and how to tell which unit is being used. So if I get that list, I will try to update the plugin to accommodate the various models.

Nice. Ill keep an eye on this thread I just found out about OpenSprinkler and for $99 with all this functionality its sounding like a good deal. Plus I noticed in the latest HomeWave update support for the OpenSprinkler Plugin was added which is a major plus.

I originally looked at the Asante irrigation controller. However it only has 6 zones and I need 8 so OpenSprinkler is what I’d like to get. My birthday is less than a month so…lol…

I hope you are still working on this. I would certainly help out with testing as I did with a MyQ device for my garage. I just like how OpenSprinkler is literally meant to be open and not all the other closed proprietary solutions. Thanks!

[quote=“tomtcom, post:7, topic:185261”]I originally looked at the Asante irrigation controller. However it only has 6 zones and I need 8 so OpenSprinkler is what I’d like to get. My birthday is less than a month so…lol…

I hope you are still working on this. I would certainly help out with testing as I did with a MyQ device for my garage. I just like how OpenSprinkler is literally meant to be open and not all the other closed proprietary solutions. Thanks![/quote]

I haven’t really heard any complaints about the arduino based open sprinkler running with this version of the plugin. I have to make some changes to get it to work with the Pi version of the unit.

Bruce

I didn’t readily see the difference on their site nor a reference in the faq. How are you knowing what you get directly from their site?

Edit…I meant pi or arduino.

As far as the end user is concerned, you probably wouldn’t see much difference between the arduino or pi versions. But from the aspect of someone developing the software, or in this case a plugin for the unit, there are some differences in the two. Obviously, the arduino and pi are using two completely separate micro controllers, which means the firmware is not identical. The firmware is developed by different developers and while they try to maintain compatibility with the API, the pi version is lagging behind somewhat, so we have to code around those differences.

On the website, this page lists all the various options.

Bruce

Ahh, I see. Thanks for that. Sorry I missed it.

I have OSPi. I love how it has raspberryPI. Did not realize that OpenSprinkler and OSPi had different API. I would developer for mios app gets this working for OSPi.OSPi was so easy to setup and replace my existing system, 10 min. Can control via phone while at home. Once it works with Vera, I would have one interface to all my stuff and access to OSPi via internet via vera apps.

Here is my version of OSPi
Software version: 2.2.30 (2015-02-21)

Kyle

[quote=“kyle.dawson, post:13, topic:185261”]I have OSPi. I love how it has raspberryPI. Did not realize that OpenSprinkler and OSPi had different API. I would developer for mios app gets this working for OSPi.OSPi was so easy to setup and replace my existing system, 10 min. Can control via phone while at home. Once it works with Vera, I would have one interface to all my stuff and access to OSPi via internet via vera apps.

Here is my version of OSPi
Software version: 2.2.30 (2015-02-21)

Kyle[/quote]

The API is mostly the same, maybe about 85%. The Pi version is just lagging behind the development of the Arduino based version a little bit. Since your firmware version was just released about a week ago, they might have made some more advances and I’ll need to check out to see what they’ve done. The biggest hurdle is that the Pi version still used the Auto/Manual mode settings in order to control valves individually (which is what we need from Vera), but the Arduino version has done away with that concept entirely. I’ve been a little swamped and haven’t been able to get finished incorporating the Pi support into the new plugin. But hopefully I’ll have something for you Pi users to try out soon.

Bruce

Thanks for follow up. If you need help, testing, coding, let me know. I can help. Not sure if you have pi version to test with.

New unified firmware just posted.

This means the same plugin should work for all platforms.

But the password string is handled differently.

It now requires and md5 hash of the password instead of the clear text. Not sure how this will work with the Vera plugin since it is winter here and my sprinklers are still disabled.

you can use the fciv.exe tool (Search and download from microsoft) to generate an md5 hash easily on Windows. Or maybe the plugin can be changed to take the password in clear text and send it in md5?

New features are sunrise/sunset control on the sprinkler controller.

[quote=“Ramias, post:16, topic:185261”]New unified firmware just posted.

This means the same plugin should work for all platforms.

But the password string is handled differently.

It now requires and md5 hash of the password instead of the clear text. Not sure how this will work with the Vera plugin since it is winter here and my sprinklers are still disabled.

you can use the fciv.exe tool (Search and download from microsoft) to generate an md5 hash easily on Windows. Or maybe the plugin can be changed to take the password in clear text and send it in md5?

New features are sunrise/sunset control on the sprinkler controller.[/quote]

Wow, this is great news. I’ll have to download it and put it on my OS so I can test with it. This should make my job much easier :slight_smile:

Bruce

The new plugin seems to be working great… although it is winter and won’t be able to actually test for a while, it seems to work. It only detected zones 1 and 2, but after I updated the list, it pulled in all the info from the others.

Thanks!

I’ve updated the first post with a new I_OpenSprinkler1.xml file. This should now work with the new unified firmware 2.1.3 and above and hopefully will work with no tweaks on the OSPi. Because they now use a MD5 hash on the passwords, this new file will only work with firmware 2.1.3 and later. If you aren’t ready to update your firmware, then don’t upload this new version of I_OpenSprinkler1.xml.

Bruce

Just tried plugin with new file, getting new error:

OpenSprinkler : Error manually controlling valve Bad Status Code: 404

OSPi
Software version: 2.2.30 (2015-02-21)

FYI… In Florida, so I can do any testing you like… 75 here today :slight_smile: