Announcement

Collapse
No announcement yet.

Migrating functions from SG to HS

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

    Migrating functions from SG to HS

    I recently moved my SG activity largely to HS. To do that I did the following:
    • Replaced all lighting events in SG with events and scripts in HS. That was tedious, and sometimes challenging, but not difficult. I moved one room at a time and discovered that once I had a few basic techniques under control, translating or expanding them to additional rooms was pretty quick.
    • Connected my RCS serial thermostats to the Serial Thermostat plug-in. The plug-in works very well. The switch was quick and nearly painless. The most significant change is that the thermostats must be polled explicitly by HS, and a separate script is needed to populated HS devices with thermostat data. Of course, all events and scripts that reference thermostat data or settings had to be updated.
    • Connected my NetworX NX8e to the jvCaddx plug-in. The biggest challenge I encountered was that initially the plug-in took a long time (hours!) to fully interrogate the NetworX system. Once that was completed, however, the plug-in has worked transparently. Again, all events and scripts that reference the security system had to be updated.
    • Added a Way2Call modem connected to HSPhone.

    That left IR and IO. I moved some digital inputs to spare zones on my alarm panel. (Those zones are in Partition 3 so they do not affect the functioning of my actual alarm, which is Partition 1.)

    Other digital inputs, analogue inputs, and IR remain with SG for now. I use ASCII exchange between SG and HS to coordinate them. I'll put my ASCII scheme in another post.
    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

    #2
    Migrating from SG to HS II - ASCII

    Options for digital IO are limited and fairly expensive. Since my SG box is still working fine, it seemed a waste not to make use of its excellent IO capability. To do that, though, I needed a way to communicate changes to HS.

    Similarly, with IR. I do not do much with IR and my JDS IR expander does the job. Rather than invest in new hardware I decided to try to continue to rely on SG. Again, I needed a way to let SG know when to send IR and which IR signal to send.

    Sending an ASCII message on a serial connection between the two boxes turns out to be quick and reliable, and pretty easy to set up. The SG side is nearly obvious to anyone familiar with Starglish.
    • To trigger an event, in this case to send an IR command, -
    EVENT: DRAudOn
    If
    ASCII-In:'DR Aud On' [COM2]
    Then
    (IR:ABus ON ) play 3 time(s) [Emitter4]
    End
    • To send data, in this case an A/D value -
    (V:Light Level) LOAD with (A/D:PhotoCell)
    ASCII-Out:'LL||[<light level="">Light Level]$' [COM3]
    </light>
    The '$' is just the EOL terminator that I chose.


    On the HS side a com port needs to be opened, then scripts can send and receive data on the port. I chose to open the com port in the 'starup.txt' file. The line I added is:
    hs.OpenComPort 18, "9600,N,8,1", 1, "GetSG_ASCII.vb", "Main", "$"
    Note, the '$' at the end. When that character is received, HS automaticall calls the script, "GetSG_ASCII.vb", which parses the received ASCII string.

    (*** Update: in HS3 the function name was changed to hs.OpenComPortTerm ***)

    To send data to SG, all that is required is the 'SendToComPort' command, which can be an immediate script in a device action or a line in a script. For example,
    hs.SendToComPort(18, "DR Aud Off" & chr(13))
    The 'chr(13)' at the end is required to signal EOL to SG.


    The script I use to receive data is below. I chose to use a standard form that consists of a 2-character header followed by '||' as a separator, then the message and the EOL character '$'. So my light level signal looks like 'LL||40$' when it arrives at the HS com port, and 'LL||40' as the input string to my parsing script.


    GetSG_ASCII.vb:

    Code:
        Sub Main(ByVal strData As String)
    
            Dim strSubject As String = strData.Substring(1,2)
            Dim strMessage As String = strData.Substring(5)
    
        hs.WriteLog("SG_ASCII", strData)        'debug
    
              Select Case strSubject
    
              Case "LL"    'Light Level
    
        hs.SetDeviceValue("U49", CInt(strMessage))
        hs.SetDeviceString("U49", strMessage)
        hs.SetDeviceLastChange("U49", NOW)
    
    
              Case "AC"    ' AC Power
    
        hs.WriteLog("SG_ASCII", strData)
        hs.WriteLog("SG_ASCII", strSubject)
        hs.WriteLog("SG_ASCII", strMessage)
    
        If strMessage = "Power On" Then
             hs.SetDeviceStatus("U60", 2)
        Else
             hs.SetDeviceStatus("U60", 3)
        End If
    
              Case "PF"    ' AC Power
    
        hs.WriteLog("SG_ASCII", strData)
        hs.WriteLog("SG_ASCII", strSubject)
        hs.WriteLog("SG_ASCII", strMessage)
    
        If strMessage = "Main Power Off" Then
             hs.SetDeviceStatus("T1", 3)
        End If
    
    
              Case "DA"    'Deck Amp
    
        If strMessage = "Deck Amp On" Then
             hs.SetDeviceStatus("M30", 2)
        Else
             hs.SetDeviceStatus("M30", 3)
        End If
    
              Case Else
    
        hs.WriteLog("SG_ASCII", strData)
        hs.WriteLog("SG_ASCII", strSubject)
        hs.WriteLog("SG_ASCII", strMessage)
    
    
              End Select
    
        End Sub


    Last edited by Uncle Michael; December 9, 2016, 11:15 AM. Reason: Add note for HS3 function info
    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


      #3
      Thanks so much! I am eager to try some of your ideas, especially the ASCII script. I had written a script like that back in HS 1.7, but the COM port stopped working for me with HS2, so I haven't tried anything like that since. But I suspect that your idea will work if I give it a go.

      I think I'll make this jump once HS3 comes out, at which time I'll be rebuilding my HS configuration anyway.

      For now, I'll move my Jandy pool interface to the ISY (via an Autelis adaptor) and I'll move my security to the CADDX plug-in (or an Elk which could connect directly to the ISY for fast and direct triggering of lighting events).

      My biggest problem is that I currently still use the JDS LCD keypads for control, and in order to ditch the Stargate, I need to keep my master variables in Homeseer.

      Are you using HSTouch now for your interface, and if so, what are you using for in-wall controls?

      Thanks,

      Tim

      Comment


        #4
        Originally posted by timlacey View Post
        Are you using HSTouch now for your interface, and if so, what are you using for in-wall controls?
        Tim,
        I am using HSTouch. My HSTouch interfaces are either iPods or iPads, but for in-wall control I use keypads from my lighting system, either Compose (where I started) or UPB (where I'm going). I also use PalmPads and X10 key chain remotes. Not elegant, but inexpensive and very easy to use.
        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


          #5
          Nice work, Uncle. Thanks for blazing the trail on one option for the Post-Stargate era. I'm not willing to stay on HS 2.5 indefinitely, so you present an option.

          I really need the I/O (especially relay out) so I'm considering transitioning to Elk M1G, but that is basically a complete do-over - not something I look forward to.

          I really like the fact that SG can operate independent of HS crashes. Do you find HS and HSTouch reliable enough to commit your whole house to it? I think at least some of my HS problems are due to the serial link to SG, so I'm fearful of replacing with two more serials (Caddx and RCS Thermos).
          Mark

          Comment


            #6
            I find HS rarely crashes. In fact, I can't think of the last time it crashed on its own. I restart it manually sometimes when I manually run Windows Update, and every now and then I restart it to resolve funny issues with the Way2Call phone interface. But it never crashes.

            I am buying a pool controller from Autelis to remove it from my Stargate. To keep Homeseer simple, I will connect Autelis to the ISY and use the ISY plug-in to manage it.

            I am moving my irrigation most likely to the rain8net irrigation devices, which will connect via a new serial link to Homeseer. I was reluctant to do this in the face of TCP solutions out there, but the plug-in and user base for rain8net within Homeseer seems the best.

            Tim

            Comment


              #7
              Originally posted by Mark S. View Post
              Nice work, Uncle. Thanks for blazing the trail on one option for the Post-Stargate era.
              Thank you, but I'm actually recreating what some were using before the SG plug-in was available, so I won't claim too much credit for originality, although it is new for me.

              I really like the fact that SG can operate independent of HS crashes. Do you find HS and HSTouch reliable enough to commit your whole house to it? I think at least some of my HS problems are due to the serial link to SG, so I'm fearful of replacing with two more serials (Caddx and RCS Thermos).
              I have found HS to be very reliable. Like you, I also suspected the serial link between HS and SG, but after removing much of the dependencies I realized that it was probably a problem with the plug-in itself. I have had no trouble with adding new serial links, and certainly none of them have caused HS to crash. In fact, now that I no longer use the SG plug-in, HS actually runs more smoothly and with fewer odd behaviors.

              The only time in a long time HS crashed was when I made a programming error in a script and sent HS into an endless loop.
              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


                #8
                Any chance to get a detailed explanation of your script? I don't know anything about scripts, but I would love to duplicate what you've done here in HS3.

                Thanks
                -Tim

                HSPro - 3.XXX - Dell mini W7 x32
                Way2 Call
                Elk M1 Gold
                UPB HAI switches
                HAI RC2000 Thermostat

                Comment


                  #9
                  I tried to make the description in post #2 as detailed as I could. What specific script statements do you want to know more about?
                  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
                    I don't understand how you're passing data between SG and HS3. It looks like you're showing specific examples for lighting. I assume that I would substitute my own variables for yours?
                    -Tim

                    HSPro - 3.XXX - Dell mini W7 x32
                    Way2 Call
                    Elk M1 Gold
                    UPB HAI switches
                    HAI RC2000 Thermostat

                    Comment


                      #11
                      Originally posted by email68 View Post
                      I assume that I would substitute my own variables for yours?
                      Yes, that's right.
                      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


                        #12
                        I'm simply sending data strings from HS to SG or from SG to HS. Based on the content of the strings, the receiving device takes specific actions, either storing the contents of passed variables, or triggering events, or both.
                        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


                          #13
                          Ok. I'll give it a go. I have a SG and and IO expander. So I'd love to use all that IO.

                          Where is the startup.txt located so I can add the comport open command?
                          -Tim

                          HSPro - 3.XXX - Dell mini W7 x32
                          Way2 Call
                          Elk M1 Gold
                          UPB HAI switches
                          HAI RC2000 Thermostat

                          Comment


                            #14
                            Originally posted by email68 View Post
                            Where is the startup.txt located so I can add the comport open command?
                            It's a script file in the HS scripts folder.
                            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


                              #15
                              Thanks. I'll have a look.

                              I'm sure I'll be back with more questions ;-)
                              -Tim

                              HSPro - 3.XXX - Dell mini W7 x32
                              Way2 Call
                              Elk M1 Gold
                              UPB HAI switches
                              HAI RC2000 Thermostat

                              Comment

                              Working...
                              X