Announcement

Collapse
No announcement yet.

Updated EtherRain Sprinkler Control Interface

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

    #31
    Originally posted by simonmason View Post
    I added the following code after line 326 in the standard script - after the section titled - "but now check rain..."

    Code:
    		'Checking rain sensor...
    		
            If wstr = "1" Then
    			'Rain sensor on
    			'Rain sensor is normally closed (NO) so a "1" indicates that it is wet
                responsestr = responsestr & "(Rain)"
    			hs.writelog ("EtherRain", "Rain Sensor is on - raining")
    			'Set rain sensor status - R14
    			hs.SetDeviceStatus ("R14", 2)
            End If
    
    		If wstr <> "1" Then
    			'Rain sensor off
    			'Rain sensor is normally closed (NO) so something other than a "1" (presumably a 0) indicates that it is not wet
    			hs.writelog ("EtherRain", "Rain Sensor is off - Not raining")
    			'Set rain sensor status - R14
    			hs.SetDeviceStatus ("R14", 3)
            End If
    Thanks. So you created a virtual device R14 and run events off that?

    Comment


      #32
      Yes,

      I have an elaborate set of scripts that I developed for my X-10 controller - using MainLobby as the main interface. I am in the process of converting them over to use for the etherrain controller. I have not gotten far because my sprinkler system is in disarray - Sandy damage - and I have been waiting for the repair guy for over 2 months!

      Comment


        #33
        Well that snippet of code works great. I shouldn't have waited so long to determine rain sensor status. I'd always be wondering now did the irrigation system not go on because the sensor was on, did HS screw up? Thanks again.

        Comment


          #34

          Comment


            #35
            Thanks Jim. I am using the script above and it is working great.

            Comment


              #36
              Starting small

              First of all thanks for helping (these forums are great).

              Starting small as I have a simple setup because I don't have a any programming knowledge and having trouble with something simple and then expanding on it.

              I have EtherRain and I want to eventually see the status of it in HS Touch. I think the best way to do that is to have a virtual device. Virtual device is where I currently have an issue and I cannot seem to change the status in the status screen. So for testing I am just trying to set the device value (see below). Just to make sure I am doing this correctly I am doing this in the events and under running a script so that I can see it in the log (not sure if there is another way to do this).

              Sub Main
              &hs.SetDeviceStatus ("V1", 3)
              End Sub


              Again thanks for anyone who can help for a non-programmer.

              Comment


                #37
                Your event will turn on that device - but what is triggering it? I don't think you can do this from an event unless you call the event with something. Etherrain comes with its own script - you need to set up an event to run this script on a regular basis. Here is what I am doing...

                Etherrain Status
                Recurring every 5 minute(s)
                WHEN
                Everyday
                Run script: EtherRain.vb("getStatusRet", "EtherRain.8")

                Then you need to place the code to update the virtual device in the ether rain.vb (see my post above).

                Comment


                  #38
                  First of all thank you for your help.

                  Couple different things are happening. I had different code than you (mine was May 2012) and I am running EtherRain7. With that being said your code does work, but I don't think it is doing what I want and I think your code is checking for rain using a sensor (NC?)?

                  I am hoping to get the status of whether or not EtherRain is running and what zone it is on? The code did work by changing the status on the status screen to off where it was unknown earlier (this actually helped me out a lot - ).

                  Another question maybe you all can answer is there a way to make it so I can input my on times into the HS Touch screen (like if you used OptiRain QuickCycle) for each zone. I'm pretty sure there is as I can see the command lines in the log from when I run an event (where it is the command etherrain.vb,something,X,X,X,X,X,X,X - where "X" represents zones). I am just trying not to recreate the wheel.

                  Jim,

                  Can you give us a heads up on what we might have to do for HS3 release since I think your scripts are in VB and they are trying to make everyone standardize on .Net Framework? Just trying to be a forward thinker.

                  Comment


                    #39
                    I see what you are saying. I did misread your question. My code was for the rain sensor. I haven't looked at the code that closely but there must be a variable that is set when the device is running? Will take a look.

                    As for HS3 - I don't plan to update right away. I will need to go through a lot of plugins and code to figure out what works and what doesn't. With Cinemar MainLobby it took me almost a year to finally switch over!

                    Comment


                      #40
                      Originally posted by edstasneyjr View Post
                      First of all thank you for your help.
                      Jim,

                      Can you give us a heads up on what we might have to do for HS3 release since I think your scripts are in VB and they are trying to make everyone standardize on .Net Framework? Just trying to be a forward thinker.
                      Ed:
                      No worries on HS3. I have a copy of the HS3 beta and will be porting the scripts to HS3. Converting to ASPX won't be difficult, however the beta version as it stands is missing some things and Homeseer needs to provide some better documentation on how an event can by programmatically generated given that at this time it seems that they removed some simple event generating functions from their scripting library.

                      I hope to have the scripts updated when HS3 is out of Beta, I know some customers want them updated sooner. I just have to wait until the information is available. The HS3 scripts will be downloadable in a separate zip file when available and will be labled for HS3.

                      Jim

                      Comment


                        #41
                        Originally posted by simonmason View Post
                        I see what you are saying. I did misread your question. My code was for the rain sensor. I haven't looked at the code that closely but there must be a variable that is set when the device is running? Will take a look.
                        Simon:
                        Using your technique, you could parse for "ready," "busy," and "waiting" in the status response string. You'd need another virtual device for controller status. if the string returned from the getStatusRet function includes "busy" or "waiting" then the controller is "running." You can view the inline comments at the function in EtherRain.vb

                        I'm not well versed in devices or virtual devices for HomeSeer at this point but from what I understand they can only have an "on" or "off" state so it looks like you need a virtual device for every binary parameter, especially if you are monitoring from HSTouch (which I know little about at this point).

                        Jim

                        Comment


                          #42
                          There is away to get the status into the log and put it into a virtual device. Just following the logic from earlier above this post.

                          Edit lines (below this statement)
                          ( responsestr = devnamestr & " Working. Status: ")


                          responsestr = devnamestr & " Working. Status: "
                          'now need to get status (ready/busy/waiting/rain/short)
                          'setup the url
                          myurl = "http://" & erdevices(j).ipPort
                          'also, make sure the password is accepted
                          qstr = "/" & resultPage & "?" & "xs"
                          url = myurl & qstr
                          rez = getPage(url)
                          If Not rez Then
                          getStatusRet = responsestr & "Unknown"
                          Exit Function
                          End If
                          k = InStr(webstr, "os:")
                          'check operating status
                          wstr = "?"
                          If k > 0 Then
                          wstr = Mid(webstr, k + 4, 2)
                          End If
                          If wstr = "BZ" Then
                          getStatusRet = responsestr & "Running"
                          hs.writelog ("EtherRain", "EtherRain is Running")
                          hs.SetDeviceStatus ("R15", 2)
                          Exit Function
                          End If
                          If wstr = "WT" Then
                          getStatusRet = responsestr & "Waiting"
                          hs.writelog ("EtherRain", "EtherRain is Ready")
                          hs.SetDeviceStatus ("R15", 2)
                          Exit Function
                          End If
                          If wstr = "RD" Then
                          responsestr = responsestr & "Ready"
                          hs.writelog ("EtherRain", "EtherRain is Ready")
                          hs.SetDeviceStatus ("R15", 2)
                          End If
                          'but now check short
                          k = InStr(webstr, "rz:")
                          'check operating status
                          wstr = "?"
                          If k > 0 Then
                          wstr = Mid(webstr, k + 4, 2)
                          End If
                          If wstr = "SH" Then
                          getStatusRet = responsestr & "(Short)"
                          Exit Function
                          End If




                          specifically you want the:

                          hs.writelog ("EtherRain", "EtherRain is Ready")
                          hs.SetDeviceStatus ("R15", 2)

                          or whatever corresponds to your virtual device (mine is R15). The next phase that I have to figure out is a way to make the virtual device something other than values 0,1,2,3 and make them represent something else. I have seen somewhere to do this.

                          Hope this helps someone.

                          Comment


                            #43
                            Got the status to display in the Display web page in homeseer and in the log location. I am using R15 as my virtual device. Below is the code that I used that was changed from the original. it is mostly just changing to lines in the corresponding locations

                            hs.writelog ("EtherRain", "EtherRain is Ready")
                            hs.SetDeviceString ("R15", "Ready")




                            responsestr = devnamestr & " Working. Status: "
                            'now need to get status (ready/busy/waiting/rain/short)
                            'setup the url
                            myurl = "http://" & erdevices(j).ipPort
                            'also, make sure the password is accepted
                            qstr = "/" & resultPage & "?" & "xs"
                            url = myurl & qstr
                            rez = getPage(url)
                            If Not rez Then
                            getStatusRet = responsestr & "Unknown"
                            Exit Function
                            End If
                            k = InStr(webstr, "os:")
                            'check operating status
                            wstr = "?"
                            If k > 0 Then
                            wstr = Mid(webstr, k + 4, 2)
                            End If
                            If wstr = "BZ" Then
                            getStatusRet = responsestr & "Running"
                            hs.writelog ("EtherRain", "EtherRain is Running")
                            hs.SetDeviceString ("R15", "Running")
                            Exit Function
                            End If
                            If wstr = "WT" Then
                            getStatusRet = responsestr & "Waiting"
                            hs.writelog ("EtherRain", "EtherRain is Waiting")
                            hs.SetDeviceString ("R15", "Waiting")
                            Exit Function
                            End If
                            If wstr = "RD" Then
                            responsestr = responsestr & "Ready"
                            hs.writelog ("EtherRain", "EtherRain is Ready")
                            hs.SetDeviceString ("R15", "Ready")
                            End If
                            'but now check short
                            k = InStr(webstr, "rz:")
                            'check operating status
                            wstr = "?"
                            If k > 0 Then
                            wstr = Mid(webstr, k + 4, 2)
                            End If
                            If wstr = "SH" Then
                            getStatusRet = responsestr & "(Short)"
                            Exit Function
                            End If


                            Now to the next hurdle of which Zone is it on.

                            Comment


                              #44
                              Thanks for the pointers. I adding the following calls into my setup as well. I have an event that runs every 5 minutes to poll the etherrain. I originally set this up to poll the rain sensor. In order for this to accurately return the status of the controller I will probably have to move it to polling every minute. It would be nice if there was a way to fire an event from the controller when it starts anything, it would save having to poll it.

                              Comment


                                #45
                                Thanks to Jim for helping me get the zone/station information into HS and HS Touch. The key to this is listed below.

                                What Jim gave me.

                                Try inserting the code above the line:

                                k = InStr(webstr, "os:")

                                and

                                k = InStr(webstr, "ri:")
                                wstr = "?"
                                If k > 0 Then
                                wstr = Mid(webstr, k + 4, 1)
                                End If
                                hs.writelog ("EtherRain", wstr +1)



                                I expanded on a previous post do to this information resetting the zone information back to 0 otherwise it is on 8 when the next cycle runs. (mostly just adding

                                hs.writelog ("EtherRain", "reseting zone to 0")
                                hs.SetDeviceString ("V1", "0")

                                )


                                If wstr = "BZ" Then
                                getStatusRet = responsestr & "Running"
                                hs.writelog ("EtherRain", "EtherRain is Running")
                                hs.SetDeviceString ("R15", "Running")
                                hs.writelog ("EtherRain", wstr + 1)
                                hs.SetDeviceString ("V1", wstr + 1)
                                Exit Function
                                End If
                                If wstr = "WT" Then
                                getStatusRet = responsestr & "Waiting"
                                hs.writelog ("EtherRain", "EtherRain is Waiting")
                                hs.SetDeviceString ("R15", "Waiting")
                                hs.writelog ("EtherRain", "reseting zone to 0")
                                hs.SetDeviceString ("V1", "0")
                                Exit Function
                                End If
                                If wstr = "RD" Then
                                responsestr = responsestr & "Ready"
                                hs.writelog ("EtherRain", "EtherRain is Ready")
                                hs.SetDeviceString ("R15", "Ready")
                                hs.writelog ("EtherRain", "reseting zone to 0")
                                hs.SetDeviceString ("V1", "0")
                                End If


                                Hope this helps.

                                Comment

                                Working...
                                X