Announcement

Collapse
No announcement yet.

New OpenSprinkler Plugin

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    New OpenSprinkler Plugin

    Hi All,

    This thread is about a plugin for the OpenSprinkler Controller.
    https://opensprinkler.com/

    This started off as a learn vb.net project for myself. I finished it off and published the first version here. I also published the source files and Brady (jbbtex) kindly added a ton of functionality and republished the source. The version attached in this post (OpenSprinkler-1.0.4.0) will work for Firmware 2.04 - Newer versions (OpenSprinkler 1.1.0.0 +) supporting Firmware 2.10+ are available in the updater.

    Basic Functionality:

    Install and run the plugin and go to the config page. Set the IP address, port, password, of your OpenSprinkler controller set a poll rate. Homeseer will then poll the Controller and detect the number of zones and programs. It will create a root device for the controller, a device for each station (sprinkler zone), a device for each registered program, a rain delay device, a status device, a history device, a rain sensor device (if enabled) and an overall watering percentage device.

    Homeseer will then poll the device continuously for status. If the wrong (or no) answer is recieved, all devices will show Comms Fail. Each device will display it's current status.

    The controller (root device) can be enabled, disabled or rebooted - all with status feedback.
    Each station can be turned on for a set period of time (at your choosing) or turned off.
    Programs will display status and will allow you to enable, disable or run-once (with current station times).
    A Rain delay can be set/reset which will stop the stations activating for a set period of time.
    A watering percentage device can be used to set an overall time adjust factor, this can also be set to auto-weather control or manual control.
    A status device tells which station is currently running - and also displays OpenSprinkler's feedback for each command sent by Homeseer. This has a 'stop all' button'.
    A history device displays the last station to run.
    A rain sensor device (only built if rain sensor enabled) will show the status of this device.
    The config page will also show a log of all activity over the last month.

    Source code can be shared by request - send me a message.

    Version History:
    0.1.1.0 - original version by mattyjee
    0.1.2.0 - added (not successfully) expansion boards
    1.0.0.6 - Ton of functionality added by jbbtex.
    1.0.0.7 - bug fixes by jbbtex
    1.0.0.8 - bug fixes by jbbtex
    1.0.1.0 - bug fixes and rewrite for ease of future updates by mattyjee
    1.0.2.0 - added watering ratio device
    1.0.3.0 - can now adjust zone watering time of each program.
    1.0.4.0 - bugs fixed in previous version which would reset other settings when water% set. Enhanced the general debugging capabilities.
    1.1.0.0 - Provides support for new OpenSprinkler Firmware v210 including extra functionality, also converted plugin to be available through the updater and now no need to manually edit ini file.
    1.2.0.2 - Provides support for new OpenSprinkler Firmware v213 (MD5 password). Adds buttons for Program devices. Also now Linux compatible.
    1.2.1.0 - Fixes bugs with program device buttons not rendering on webpage. Fixes compatibility issue with new Firmware v214.
    Attached Files
    Last edited by Mattyjee; June 6, 2019, 06:43 PM.

    #2
    I'd be interested to try this out, but I have 23 irrigation zones.

    I really like the ability to set the zone manual watering time from the Device page.

    Comment


      #3
      I'm not sure if I'm smart enough to have it work with expansion zones just yet - I also don't have a way to test it... I'll have a quick look later and see if it's simple or not.

      Cheers.

      Comment


        #4
        I just got my hardware today and hope to have it installed by the weekend. I'd be happy to test things for you.

        I'm not much of a coder, but I have written quite a few vb .net scripts that I use with my setup.

        Comment


          #5
          Hi Brady,

          I'm unable to test this version, but you should now be able to add expansion zones. Just edit the number of expansion zones into the .ini file and it should create the correct number of devices and work for them all. As I said, I can't test this so if it's no good let me know and just try my original post instead.

          Cheers.
          Last edited by Mattyjee; October 26, 2014, 05:25 AM.

          Comment


            #6
            Originally posted by Mattyjee View Post
            Hi Brady,

            I'm unable to test this version, but you should now be able to add expansion zones. Just edit the number of expansion zones into the .ini file and it should create the correct number of devices and work for them all. As I said, I can't test this so if it's no good let me know and just try my original post instead.

            Cheers.
            I tried this but couldn't get it to work.

            After looking at the docs on OpenSprinkler, I decided to do what I needed with scripts.

            Thanks

            Comment


              #7
              It is pretty easy to do with scripts, however what part specifically didn't work so I can have a look at my code? Did you edit your IP address in the .ini file?

              Comment


                #8
                Originally posted by Mattyjee View Post
                It is pretty easy to do with scripts, however what part specifically didn't work so I can have a look at my code? Did you edit your IP address in the .ini file?
                Log:

                Code:
                Aug-16 9:31:31 AM           Info     Plugin OpenSprinkler has connected. IP:127.0.0.1:2012
                Aug-16 9:31:30 AM           Warning     I/O interface OpenSprinkler is down, executable is not running, restarting ...
                Aug-16 9:31:00 AM           Info     Plugin OpenSprinkler with instance: has disconnected
                Aug-16 9:30:31 AM           Info     Plugin OpenSprinkler has connected. IP:127.0.0.1:1984
                Aug-16 9:30:31 AM           Warning     I/O interface OpenSprinkler is down, executable is not running, restarting ...
                The only device created is "OS-0."

                This is my .ini:
                [Settings]
                IPaddress=192.168.0.81
                IPPort=80
                Password=password
                Expansions=2

                Comment


                  #9
                  That's strange - I can't replicate the fault after trying a number of different permeations. It's a weird part of the code to fail on. Unfortunately I'm only a very ameteur programmer so can't offer too much help.

                  There's only one scenario I can think of that caused this. Did you start the plugin once before copying the .ini file across? If so that would do it.

                  If you did get an error and then tried again, it will not attempt to recreate any devices unless you delete ALL OpenSprinkler devices (including OS-0) and then restart the plugin.

                  No pressure to test this since you've set up your scripts.
                  Cheers.
                  Matt.

                  Comment


                    #10
                    Here is the source code if anyone is interested...

                    If anyone uses this or makes changes - please post back to me.
                    Cheers.
                    Matt.

                    Edit - source code attachment removed - it was old and crappy anyway. Email me if you want the latest copy.
                    Last edited by Mattyjee; October 26, 2014, 05:26 AM.

                    Comment


                      #11
                      Thanks for the source Matt. I made a couple of tweaks and have it working with my 24 zone system.

                      I'm away on vacation now but will explain what I changed when I'm back home later this week.

                      My plan is to incorporate the scripts I've been using. This will require creating a few more devices.

                      And I hope to be able to read the zone names from Open Sprinkler and use them for the device names in HS. We'll see.

                      Since I've never done a plug in before, I may be asking for some help.

                      Thanks again.


                      Brady

                      Comment


                        #12
                        Cool. looking forward to it.

                        Cheers.
                        Matt.

                        Comment


                          #13
                          Here is what I have so far. Just the source files.

                          The .ini file should have the following entries:
                          [Settings]
                          IPaddress= OS ip address
                          IPPort=OS ip port
                          Password= password
                          Expansions= number of expansion boards
                          (note: current OS expansion unit = 2 boards
                          Poll= plugins polling interval in seconds

                          I have tested this on an OpenSprinkler system with 24 stations and 4 programs running in Sequential mode.

                          The first time the plugin runs, it will create devices for all the zones and programs. The Zones will be named based on the Station Names from OpenSprinkler. The Programs will be named "Program 1", etc.

                          On each poll, the plugin will set the Program devices' strings to indicate the next day the program will run. It will also check to see if any Zones are running. If a zone is running, then the Zone's device string will show what Program (or Manual, Run-once) is controlling the Zone and how much time is remaining before the Zone stops. If a Program is in progress, then all the zones will show the Program name and run time, but only the currently running zone will count down the time and indicate that it is active.

                          Planned additions:
                          • A device that shows if the Rain Delay is Active and for how long.
                          • A device that shows what zone last ran and the time it stopped.
                          • Changing the behavior of the Zone device drop down to create a run-once program just for that zone, rather than manually run a zone. This will eliminate the need for the user to change back to Program Mode.


                          Since I'm an amateur at coding, I'm sure the code is pretty clunky. And there are probably better ways to do the things I did. Constructive criticism is appreciated.
                          Last edited by jbbtex; September 2, 2014, 04:13 PM.

                          Comment


                            #14
                            Here is the latest version.

                            -Added device that shows Rain Delay Status and time and date it is scheduled to end.

                            -Added device that if a zone is running, what zone it is and count down to finish

                            -Added device that shows the last zone that ran and when it stopped.

                            -Added the following controls to the Status Controller device: 'Stop All Zones', 'Enable OpenSprinkler', 'Disable OpenSprinkler'

                            HSPI_MG-BWOpenSprinkler.zip is the source project
                            BWOpenSprinkler.zip has the .exe, config file and a text file with installation instructions.

                            Suggestions welcomed, although my skill, or lack there of, may prevent implementation.
                            Last edited by jbbtex; October 26, 2014, 09:38 AM. Reason: removed attachments

                            Comment


                              #15
                              Nice work, you've gone to town on that. I'm on holidays at the moment so can't load it (just had a browse of the .vb files) but looks like you got a lot further than i did. You're hardly an amateur coder.

                              I was always wondering if there was a way to pull status and other advanced things off the web pages and it looks like you worked out how to do it. I'll have a good look through when I get back home.

                              Another handy thing with OpenSprinkler is that within HSTouch you can create a text box, set the IsHTML to true and enter the IP address. This then gives you a direct portal to the web interface from within HSTouch.

                              The other thing i wanted to add to the plugin (although since it does what i need it to do I'm not in a hurry) was to build a webpage where you can enter the config settings instead of having to manually edit the ini file. I've only built one other plugin and that one is specific to my setup so I've hard coded those types of settings. I'm not good with html - only just learning vb.

                              Too many things to learn, not enough spare time...

                              Cheers.

                              Comment

                              Working...
                              X