Announcement

Collapse
No announcement yet.

Update Stargate RTC with HS

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Update Stargate RTC with HS

    Hi all,

    Is it possible to write an HS script to time sync the Stargate RTC with HS once a day?

    I am presently using the SG-IP Web Xpander to time sync the Starg Gate RTC once a day from the Web.

    I would like to eliminate the SG-IP Web Xpander so that I can put HS on the SG Com 1 port instead of Com 2.

    HS time is presently synced weekly by the MS Windows Internet time update function on the HS PC.

    Comments?

    Regards,
    TCIII

    #2
    Hi TCIII-

    There is a script command available to set the Stargate's time. Use this:
    Code:
    hs.Plugin("JDS StarGate").SetTime()
    -RJ (HomeSeer Tech)

    Comment


      #3
      Hi RJ,

      Thanks for the response. Much appreciated.

      Will give it a try and report back.

      Regards,
      TCIII

      Comment


        #4
        Originally posted by RJ View Post
        Hi TCIII-

        There is a script command available to set the Stargate's time. Use this:
        Code:
        hs.Plugin("JDS StarGate").SetTime()
        1) I can't get the above script line to work. It does nothing to the SG time. In the help file, it says somethng about putting the latitude and longitude in the parentheses. Is that the trick? I can't get that to work either.

        2) I tried the Set Time button in the Stargate Config page, but that sometimes does nothing or sets the time correctly, but changes the latitude and longitude to some seemingly random numbers.

        Anybody get these to work? Any suggestions?

        Mark
        Mark

        Comment


          #5
          Another clue regarding problem number 2. When I use the Set Time button on the Config page, it sometimes resets my latitude and longitude to Lat=39 and Long=105. This is somewhere in the Colorado Rockies, which is where Glen Todd lived. So I assume this is an artifact left in the code somewhere? In addition, the sunrise and sunset times in SG seem to get switched around (my lights come on in the morning and go out at night).

          Regarding number 1 - if I put lat and long in the parentheses, I get a script error in the HS log.

          Mark
          Mark

          Comment


            #6
            Hi Mark-

            Try using
            Code:
            SetStargateTime(lat As string, long as string)
            instead. This should do the trick. I will investigate the errror with SetTime() shortly.

            EDIT: It appears that you need to set your longitude and lattitude in HomeSeer before calling this function. Make sure you do that before calling it, otherwise it will use default coordinates. I am fixing this now so that it will not set the time, but rather warn you of its inability to do so.
            -RJ (HomeSeer Tech)

            Comment


              #7
              Update

              This is my latest experience:

              1) I finally got a .txt script to set the time - by putting lat and long in quotes, no parentheses - hs.plugin("JDS Stargate").SetStargateTime "41", "72". But I can't get it to work as a .vb script, but that could be just because I don't understand .vb scripting.

              But there is still a problem. It correctly sets the SG time and SG latitude and longitude, but at the same time it messes up the sunrise and sunset times in SG. My sunrise and sunset get set to something more appropriate for China. That, of course, causes my SG schedule to turn lights on at dawn and off at dusk - NG.

              2) Regarding the Set Time button on the Config page... If I put in my own lat and long, hit Save Settings, then Set Time - it correctly sets SG time and lat/long, but again it changes SG's sunrise and sunset times to somewhere in Asia.

              My lat and long is set correctly in HS Setup, but I don't see that it has any bearing on the above.

              Mark
              Mark

              Comment


                #8
                Mark,

                I assume you checked it in WinEVM as well to make sure it is right?

                I've been following this thread because I want to set up a daily event to correct the Stargate time.

                Could lat and long be reversed? where would you be in the world if you switched the two?

                Comment


                  #9
                  I think Tim hit it. I believe you need to reverse the latitude and longitude values.
                  Mike____________________________________________________________ __________________
                  HS3 Pro Edition 3.0.0.548, NUC i3

                  HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                  Comment


                    #10
                    Yes, I tried switching latitude and longitude - the sunset and sunrise times are "closer" but still not close. So I don't think that's it.

                    As I understand it, some internal SG algorith determines sunrise and sunset times based on the lat/long and time zone settings in SG. So it doesn't make sense to me that HS merely setting the SG time or lat/long should result in incorrect SG sunrise/sunset times. It seems to me that the HS plugin must be sending/doing something to SG that is changing its sunrise/sunset times.

                    Is it just me? Can someone else try it and see if it messes up your SG sunrise/sunset time? Don't worry, it's easy to fix in WinEVM.
                    It's a one line script - hs.Plugin("JDS StarGate").SetStargateTime("41", "72") with your lat/long, of course - then check sunrise/sunset times with Status button on the Stargate Control Panel page.

                    Mark
                    Mark

                    Comment


                      #11
                      Before I send any command:

                      FW Ver 3.09.1
                      Sched Name: 20070613
                      Sched Stat: running
                      06/13/2007 21:19:35
                      416 ms Cycle time
                      Sunrise: 5:38 Sunset: 19:56
                      Lat: 33, Lon: 117
                      DST: Enabled [Active]

                      After I send the command:
                      &hs.Plugin("JDS StarGate").SetStargateTime "33", "117"
                      (from the CONTROL Device tab, not from within a script)

                      FW Ver 3.09.1
                      Sched Name: 20070613
                      Sched Stat: running
                      06/13/2007 21:30:24
                      440 ms Cycle time
                      Sunrise: 5:38 Sunset: 19:56
                      Lat: 33, Lon: 117
                      DST: Enabled [Active]

                      So it didn't cause any change, but then. . .

                      Then I sent:
                      &hs.Plugin("JDS StarGate").SetStargateTime "32", "117"

                      It went berserk:
                      FW Ver 3.09.1
                      Sched Name: 20070613
                      Sched Stat: running
                      06/13/2007 21:31:54
                      400 ms Cycle time
                      Sunrise: 20:40 Sunset: 10:55
                      Lat: 32, Lon: 117
                      DST: Enabled [Active]

                      So I tried to set it back and it stayed berserk:

                      FW Ver 3.09.1
                      Sched Name: 20070613
                      Sched Stat: running
                      06/13/2007 21:33:20
                      392 ms Cycle time
                      Sunrise: 20:38 Sunset: 10:56
                      Lat: 33, Lon: 117
                      DST: Enabled [Active]

                      Yes, something is wrong.
                      The plugin is sending:
                      ##%5C00
                      ##%0500210075111107061303213600

                      Perhaps tomorrow I'll look at my Stargate Protocol docs and figure out what the plugin is actually sending.

                      Fow now, I'll fix it with WinEVM and go to bed.

                      Tim

                      Comment


                        #12
                        Thanks for confirming, Tim. It's always a relief to eliminate the "no it's just you" scenario.

                        Mark
                        Mark

                        Comment


                          #13
                          Hey Gang-

                          I did some tinkering, and I fixed a few bugs.
                          1. If you set your location in HomeSeer, your lattitude and longitude will now be set properly using hs.Plugin("JDS Stargate").SetTime()
                          2. Time Zone changes should be handled properly by the plugin now, meaning that sunrise and sunset times should be fixed as well.
                          Please give the attached build a try!
                          Attached Files
                          -RJ (HomeSeer Tech)

                          Comment


                            #14
                            Thanks, RJ. Works great now.

                            Stargate time drifts pretty badly, so this SetTime is a great feature.

                            Really appreciate your quick response.

                            Mark
                            Mark

                            Comment

                            Working...
                            X