Announcement

Collapse
No announcement yet.

New OpenSprinkler Plugin

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

    Never mind - I was able to replicate on my own system and work it out.

    It was a mess - the plug would get stuck during the start-up due to some dodgy code which has been there for a while - when you stop the plugin, it wouldn't actually stop and you could end up with multiple instances of the thing running.

    I've created and tested a new version which fixes this for good. This one actually allows you to set the IP address in the config page. Should be in updater soon under version 2.1.8.12

    in the mean time for anyone reading this - just edit the HSPI_Opensprinkler.ini file to set the correct IP and port and it will work just fine.

    I've also added support for the flow sensor, however i'm not sure i have the scaling correct - need someone to test for me.

    Cheers.

    Comment


      Thank you! I was looking into what features the open sprinkler plug in had before buying a unit. Do you have any screenshots of the configurations, etc? I was looking at open sprinkler in hopes it does not need internet access to function, only local lan connected to homeseer controller. can you confirm? Also, can individual zones be controlled manually?

      Right now i'm using a couple of 12v dc relays that are controllable through SSH. Hoping Open Sprinkler makes management a bit easier. For my current setup i have virtual devices that run a program (putty.exe) then a script to turn on /off

      Comment


        Originally posted by jacobegan View Post
        I was looking at open sprinkler in hopes it does not need internet access to function, only local lan connected to homeseer controller. can you confirm? Also, can individual zones be controlled manually?
        The Opensprinkler unit doesn't need internet connection to function and run zones, but i do think the native opensprinkler interface needs internet connection unless you locally store a javascript file on it so it can render it's web interface (I may be wrong here). It also needs internet if you are using the auto-weather update functionality. But the plugin<-->opensprinkler works fine on local lan, no internet required. Zones can be controlled manually.

        You can do everything to opensprinkler via http commands (see API document: https://openthings.freshdesk.com/hel...nts/5097673481) - that's basically all the plugin is based off - the http commands and responses. If my plugin doesn't already do what you need, you can definitely do it manually via http.

        Edit: Refer to note 20 in the API - you can redirect the javascript file to a local copy on your own network and then i think it will work without internet connection.

        Comment


          Originally posted by Mattyjee View Post

          Hey, do you still want this functionality? If so, I'd like to create and send you a test version to try before I put something in the updater.
          Yes! Sorry I didn't see this earlier.

          This would be great. Here are some of the use cases I am thinking about.
          • Alert and shut down zone if the flow exceeds a certain rate which might indicate a leak
          • Alert if the flow is below a certain rate which might indicate a clog somewhere in the system
          • Track water usage and weather conditions
          • etc.
          I would be happy to test things out for you and I can send over logs, etc. if it helps.

          Comment


            Originally posted by JohnGalt View Post
            I would be happy to test things out for you and I can send over logs, etc. if it helps.
            So the version in the updater, 2.1.8.12 has the flow sensor functionality added.

            If you install this version, ensure that your opensprinkler has the flow sensor enabled (and configured correctly) then the rebuild devices using the button on the plugin config page, then it should build a flow sensor device and give live values. Try this and let me know if you have any issues.

            BUT... I'm pretty sure the scaling is wrong as I can't work out how it is done. If you can share any screenshots of the opensprinkler config where you set up the scaling factors then I may be able to work it out. Currently what I've done is get the 'number of flow clicks' per configurable time period (30sec default) and rescale this to clicks per minute. I then multiply this by the flow scale factor - but I'm not sure what units this flow scale factor is in.

            Cheers.

            Comment


              Originally posted by Mattyjee View Post

              So the version in the updater, 2.1.8.12 has the flow sensor functionality added.

              If you install this version, ensure that your opensprinkler has the flow sensor enabled (and configured correctly) then the rebuild devices using the button on the plugin config page, then it should build a flow sensor device and give live values. Try this and let me know if you have any issues.

              BUT... I'm pretty sure the scaling is wrong as I can't work out how it is done. If you can share any screenshots of the opensprinkler config where you set up the scaling factors then I may be able to work it out. Currently what I've done is get the 'number of flow clicks' per configurable time period (30sec default) and rescale this to clicks per minute. I then multiply this by the flow scale factor - but I'm not sure what units this flow scale factor is in.

              Cheers.
              Thanks!

              I clicked on rebuild devices (I thought I already had, but maybe not) and I can now see the "Flow Sensor" device name.

              However, when I run a zone this value does not update. I ran a zone for 5 minutes and according to OpenSprinkler a total of 50.94 Liters of water were used. While I was running the zone it was saying about 11L/min was the flow rate.

              This is my understanding of the variables used in determining flow rate. It appears to be the same as your understanding as well.
              • flwrt : flow count window in unit of seconds (the firmware defines this as 30 seconds by default) (seconds)
              • flcrt : real-me flow count (i.e. number of flow sensor clicks during the last flwrt seconds) (pulses)
              • fpr{0,1} : flow pulse rate (scaled by 100) lower/upper byte. The actual flow pulse rate is ((fpr1<<8)+fpr0)/100.0 (L/pulse)
              My valve is a pulse per 0.75 gallons of water or 2.84 liters per pulse. So 3 pulses in 30 seconds is 6 pulses per minute or 6 x 2.84 or 17.04 liters per minute.

              So I makes the formula 60 / flwrt x flct x (fpr1<<8)+fpr0)/100.0

              The units are confusing. There is a bug in OpenSprinkler where the display is always in liters even if you set it to be GPM. https://opensprinkler.com/forums/top...low-in-galmin/

              Let me know if any screenshots or logs would be helpful regarding the calculations or getting the flow in HomeSeer to update.


              Comment


                Thanks. I'll take a look at it tonight and see if I can get it working properly.
                One thing that would help is if you could send me an example of your http output - particularly helpful if you can do it while you are running a zone.

                When a zone is running, enter http://[ipadress]:[port]/ja?pw=[xxx]

                where [ipaddress]:[port] is ip and port of your unit, and [xxx] is your password which has been converted to MD5 hash using the following link: https://www.md5hashgenerator.com/

                eg: http://192.168.1.9:80/ja?pw=50f87675ac231ba2bf11315f8cfdf182 (for default password of opendoor)

                This will return a string - if you could give that to me it will help me get it working.

                Cheers.
                Matt.

                Comment


                  Originally posted by Mattyjee View Post
                  Thanks. I'll take a look at it tonight and see if I can get it working properly.
                  One thing that would help is if you could send me an example of your http output - particularly helpful if you can do it while you are running a zone.

                  When a zone is running, enter http://[ipadress]:[port]/ja?pw=[xxx]

                  where [ipaddress]:[port] is ip and port of your unit, and [xxx] is your password which has been converted to MD5 hash using the following link: https://www.md5hashgenerator.com/

                  eg: http://192.168.1.9:80/ja?pw=50f87675ac231ba2bf11315f8cfdf182 (for default password of opendoor)

                  This will return a string - if you could give that to me it will help me get it working.

                  Cheers.
                  Matt.
                  Thanks Matt. I sent the data as a PM. Let me know if you need anything else.

                  Comment


                    Matt-

                    This might be related to the flow sensor, or maybe a separate issue. I run OpenSprinkler on a Rasberry PI that has mediocre WiFi reception and apparently sometimes it goes offline. I am adding another access point to help fix this, but it seems that the plugin did not recover gracefully. I tried to disable/enable the plugin and it still wouldn't connect. I tried to rebuild devices and that didn't help. I needed to restart HomeSeer for it to connect to my OpenSprinkler again.

                    Below is some log data from the OS-Debug which I thought you might be interested in.


                    Jun-14 9:07:51 AM OS-Debug UD: OpenSprinkler not read. Skipping code.
                    Jun-14 9:07:23 AM OS-Debug UD: OpenSprinkler not read. Skipping code.
                    Jun-14 9:06:54 AM OS-Debug UD: OpenSprinkler not read. Skipping code.
                    Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to set advanced status - Input string was not in a correct format.
                    Jun-14 9:06:25 AM OS-Debug Error info: jc=ERROR: The operation has timed out.
                    Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to history device - Index was outside the bounds of the array.
                    Jun-14 9:06:25 AM OS-Debug Error info: js=
                    Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to Status device - Conversion from string "" to type 'Double' is not valid.
                    Jun-14 9:06:25 AM OS-Debug Error info: rs=0
                    Jun-14 9:06:25 AM OS-Debug Error info: jc=ERROR: The operation has timed out.
                    Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to Flow Sensor device - Input string was not in a correct format.
                    Jun-14 9:06:25 AM OS-Debug Error info: rs=0
                    Jun-14 9:06:25 AM OS-Debug Error info: jc=ERROR: The operation has timed out.
                    Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to Rain Sensor device - Input string was not in a correct format.
                    Jun-14 9:06:25 AM OS-Debug Error info: uwt=0
                    Jun-14 9:06:25 AM OS-Debug Error info: wl=0
                    Jun-14 9:06:25 AM OS-Debug Error info: jo=ERROR: The operation has timed out.
                    Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to Water% device - Input string was not in a correct format.
                    Jun-14 9:06:25 AM OS-Debug Error info: jc=ERROR: The operation has timed out.
                    Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to Rain delay device - Input string was not in a correct format.
                    Jun-14 9:06:25 AM OS-Debug Error info: jp=
                    Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to program devices - Input string was not in a correct format.
                    Jun-14 9:06:25 AM OS-Debug Error info: js=
                    Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to station devices - Input string was not in a correct format.
                    Jun-14 9:06:25 AM OS-Debug Error info: en=0
                    Jun-14 9:06:25 AM OS-Debug Error info: jc=ERROR: The operation has timed out.
                    Jun-14 9:06:25 AM OS-Debug Error: Root device update failed - Input string was not in a correct format.
                    Jun-14 9:06:25 AM OS-Debug Success! INI File read
                    Jun-14 9:06:25 AM OS-Debug Device Rebuild Requested

                    Comment


                      Originally posted by bkobistek View Post

                      I just installed OpenSprinkler plug-in. I enable the plug in and it says, "INFO: Plugin start is pending." Then after several minutes, I get, "WARNING: Failed getting InterfaceStatus from OpenSprinkler - the interface was not found in the list of active interfaces, the list may need to be refreshed." I try to open the OpenSprinkler configuration page, but nothing happens. Any ideas?

                      Posted by Maggyjee


                      In your c:\program files (x86)\Homeseer HS3\Config folder would be a file called HSPI_Opensprinkler.ini

                      1) Can you please copy and paste the contents of that file for me to see
                      2) Can you please edit the file and change debug=false to debug=true if it isn't already.
                      3) Can you please retry to start the plugin and then send me anything relevant from your main Homeseer log file.

                      The above will help me to fix the problem properly.
                      For you though, the problem can most likely be fixed by setting your correct IP address and Port in the ini file. Can you confirm if this worked? (After doing the above for me please)

                      Cheers.

                      Response:

                      FYI, it's a Linux-based platform, so I found the file you're referencing in /usr/local/HomeSeer/config.

                      1) Here is the original contents:
                      [Settings]

                      IPaddress=0.0.0.0
                      IPPort=80
                      Password=opendoor
                      Poll=5
                      Debug=False

                      I'm trying to edit the .ini file, but I don't have permission. Permission is set to 644, and I can't change those either.

                      Thanks.



                      Comment


                        Originally posted by bkobistek View Post
                        Response:

                        FYI, it's a Linux-based platform, so I found the file you're referencing in /usr/local/HomeSeer/config.

                        1) Here is the original contents:
                        [Settings]

                        IPaddress=0.0.0.0
                        IPPort=80
                        Password=opendoor
                        Poll=5
                        Debug=False

                        I'm trying to edit the .ini file, but I don't have permission. Permission is set to 644, and I can't change those either.

                        Thanks.
                        I've fixed it. Download the new version in the updater, then update your IP address in the plugin config page and press "rebuild devices". It should work after that.
                        When you disable the plugin to update, just check task explorer (or the linux equivalent) and make sure there are no other 'ghost' instances of the plugin running (another bug I've fixed).

                        Let me know how you go...

                        Comment


                          Have PM'd you a new code to confirm the flowmeter is working.

                          Originally posted by JohnGalt View Post
                          I needed to restart HomeSeer for it to connect to my OpenSprinkler again.
                          I think I've fixed it in the version I PM'd you (to test flow sensor fix) but if you get this again, just check task manager to make sure there is no ghost HSPI_Opensprinkler.exe stuck running. You shouldn't need to restart HS3.

                          Originally posted by JohnGalt View Post
                          Below is some log data from the OS-Debug which I thought you might be interested in.
                          Jun-14 9:07:51 AM OS-Debug UD: OpenSprinkler not read. Skipping code.
                          Jun-14 9:07:23 AM OS-Debug UD: OpenSprinkler not read. Skipping code.
                          Jun-14 9:06:54 AM OS-Debug UD: OpenSprinkler not read. Skipping code.
                          This is the normal message if your wifi has dropped out. Turn off debug log if this is filling your log with junk.

                          Originally posted by JohnGalt View Post
                          Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to set advanced status - Input string was not in a correct format.
                          Jun-14 9:06:25 AM OS-Debug Error info: jc=ERROR: The operation has timed out.
                          Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to history device - Index was outside the bounds of the array.
                          Jun-14 9:06:25 AM OS-Debug Error info: js=
                          Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to Status device - Conversion from string "" to type 'Double' is not valid.
                          Jun-14 9:06:25 AM OS-Debug Error info: rs=0
                          Jun-14 9:06:25 AM OS-Debug Error info: jc=ERROR: The operation has timed out.
                          Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to Flow Sensor device - Input string was not in a correct format.
                          Jun-14 9:06:25 AM OS-Debug Error info: rs=0
                          Jun-14 9:06:25 AM OS-Debug Error info: jc=ERROR: The operation has timed out.
                          Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to Rain Sensor device - Input string was not in a correct format.
                          Jun-14 9:06:25 AM OS-Debug Error info: uwt=0
                          Jun-14 9:06:25 AM OS-Debug Error info: wl=0
                          Jun-14 9:06:25 AM OS-Debug Error info: jo=ERROR: The operation has timed out.
                          Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to Water% device - Input string was not in a correct format.
                          Jun-14 9:06:25 AM OS-Debug Error info: jc=ERROR: The operation has timed out.
                          Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to Rain delay device - Input string was not in a correct format.
                          Jun-14 9:06:25 AM OS-Debug Error info: jp=
                          Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to program devices - Input string was not in a correct format.
                          Jun-14 9:06:25 AM OS-Debug Error info: js=
                          Jun-14 9:06:25 AM OS-Debug Error: Failed in attempt to write to station devices - Input string was not in a correct format.
                          Jun-14 9:06:25 AM OS-Debug Error info: en=0
                          Jun-14 9:06:25 AM OS-Debug Error info: jc=ERROR: The operation has timed out.
                          Jun-14 9:06:25 AM OS-Debug Error: Root device update failed - Input string was not in a correct format.
                          Jun-14 9:06:25 AM OS-Debug Success! INI File read
                          Jun-14 9:06:25 AM OS-Debug Device Rebuild Requested
                          Normally you would see the message above about skipping code, but this means it was trying to update the device values after a dud read from the unit. I think this was from an unluckily timed press of the build devices button (mixed with some poor coding behind the build devices button of course). I hope I've fixed this in the new version. Let me know how you go.

                          Cheers.
                          Matt.

                          Comment


                            Just downloaded the update, and it works perfectly for my use!

                            One question, how do I start a station from a VB script?
                            I tried the following, assuming it would run the station(RefNr 2236) for 10 min, but nothing happens...

                            hs.SetDeviceValueByRef(2236, 10, True)

                            (Sorry, I'm a VB newbie, so I might have missed something...)

                            Comment


                              Check out CAPI in the help docs under scripting.
                              Don

                              Comment


                                Yeah, homeseer doesn't work like that. Your code is just setting the device value, but its missing the bit where that actually makes the device do something. You can use the in-build events which will work, or use the following which is copied from within my plugin - just fill in the variables with the right values...

                                Setter = hs.GetURL(IPAddress, "/cm?pw=" & Password & "&sid=" & (Zone - 1) & "&en=1&t=" & Seconds, True, IPPort)

                                setter returns a string with the opensprinkler resonse.

                                Comment

                                Working...
                                X