Announcement

Collapse
No announcement yet.

Executing a 'Then Macro'

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

    Executing a 'Then Macro'

    False start. Please see next post.
    Last edited by Uncle Michael; August 6, 2007, 09:00 AM. Reason: More 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

    #2
    I'm trying to execute a Stargate 'Then Macro' directly from HS using this script.
    Sub Main
    Dim oSG
    Set oSG = hs.plugin("JDS StarGate")
    Return = oSG.ThenMacro(10)
    hs.WriteLog "Macro", Return
    End Sub
    I have also tried it with the macro name in place of its number. In both cases the script returns 'True', but the macro does not execute.

    On the other hand, if I create an event in SG to run the macro that is triggered by setting a flag, and then set the flag in HS, the macro runs properly. Is anyone using the direct macro access feature successfully? Is there a trick?
    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
      Hi Mike-

      The problem here is probably the "return" word. Though it's not causing an error, it should be!

      Try this instead:

      Sub Main
      Dim oSG
      Dim rval
      Set oSG = hs.plugin("JDS StarGate")
      rval = oSG.ThenMacro(10)
      hs.WriteLog "Macro", rval
      End Sub
      -RJ (HomeSeer Tech)

      Comment


        #4
        Hi RJ,
        No joy. The result is the same. Rval reports 'True', but the macro does not run. Sorry. Any other thoughts?
        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
          Hi Mike-

          Enable debug logging and send me a snipet of what happens when you run the script.
          -RJ (HomeSeer Tech)

          Comment


            #6
            RJ,
            Here is the log. I hope it's more informative to you than it is to me. It appears to me that most of the log relates to other events.

            8/7/2007 2:47:04 PM Info Event Trigger "SGMacro Test"
            8/7/2007 2:47:04 PM Info Running script in background: SG Macro.txt
            8/7/2007 2:47:04 PM JDS StarGate Comms Timer event :: 184
            8/7/2007 2:47:04 PM AC RF Processor Processing Command from RF: X10 F 9 Off
            8/7/2007 2:47:04 PM X10 Received F9 ( RF MDesk) F Off
            8/7/2007 2:47:04 PM JDS StarGate Comms Sending Command: ##%2213
            8/7/2007 2:47:04 PM Macro True
            8/7/2007 2:47:04 PM JDS StarGate DEBUG gRbuffer :: :: ##0<13><10>
            8/7/2007 2:47:04 PM JDS StarGate Comms CurrentBuffer = ##0
            8/7/2007 2:47:06 PM Info Event Trigger "DRMot (delayed action)"
            8/7/2007 2:47:06 PM JDS StarGate Flag [26 (JDS DRMot) set to OFF
            8/7/2007 2:47:06 PM JDS StarGate Comms Sending Command: ##%251900
            8/7/2007 2:47:06 PM UltraStatus Info [26 (DRMot: JDS) - Idle
            8/7/2007 2:47:06 PM Info Device: Message JDS DRMot ([26) OFF
            8/7/2007 2:47:06 PM Info Deleting event after run: "Delayed Actions DRMot (delayed action)"
            8/7/2007 2:47:06 PM JDS StarGate DEBUG gRbuffer :: :: ##0<13><10>
            8/7/2007 2:47:06 PM JDS StarGate Comms CurrentBuffer = ##0
            8/7/2007 2:47:14 PM JDS StarGate DEBUG gRbuffer :: :: !!08/070536243019<13><10>
            8/7/2007 2:47:14 PM JDS StarGate Comms CurrentBuffer = !!08/070536243019
            8/7/2007 2:47:14 PM JDS StarGate Comms Flag event :: 019 -- Clear flag [26
            8/7/2007 2:47:14 PM JDS StarGate Flag [26 (JDS DRMot) Changed to OFF
            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


              #7
              This is what I use and it works great.

              if NOT oSG.ThenMacro(35) then
              hs.speak "I have a problem with Then Macro",TRUE
              end if

              I'm not sure if this is helpful, since it is what is expected.
              Perhaps the macro number is wrong?
              Perhaps the DBF file needs to be reimported to update the macro table?
              Last edited by timlacey; August 8, 2007, 12:46 AM. Reason: clean-up script

              Comment


                #8
                Tim,
                Thanks for chiming in. As I recall you have used this feature successfully.

                I've tried calling the macro by number and by name. Same result. I've reimported devices from SG. Is that what you mean by reimporting the DBF file? I've checked the JDS.ini file and confirmed the presence of the macro and its number.

                I think I'll also try several other macros to see if I can get any of them to fire. Maybe it's just the one I want to use (which is newly defined) that isn't being found.
                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


                  #9
                  Well, that was an interesting experiment.

                  The call by number does work, but either the numbering in the JDS.ini file is incorrect, or the oSG.ThenMacro(nn) call is base 1, while the numbering in the ini file is base 0. RJ or Tim, can you confirm?

                  If I convert the macro call to a base 1 number (1 greater than the number listed in the ini file, I get the macro I want, so I must have been calling the wrong macro and did not realize it. (It became obvious when I tried calling others and all manner of strange things began to happen instead.)

                  The call by name does not appear to work, however. Edit: Does the argument have to be a variable? I've just been using the macro name in quotes.
                  Last edited by Uncle Michael; August 8, 2007, 08:31 AM. Reason: added question
                  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, that is right - you have to use the numbering starting from 1. I guess trial and error is the key if you have any problems. Once you get one to work, you know the order.

                    I actually name my Macros to include the number.

                    For example, Set HVAC to Heat would be 35HVAC-Heat or something like that. It makes it easier to determine the numbers when you look at a printout of yoru Stargate schedule or when you look at the macro list. Plus the names appear in the JDS.ini file?

                    Tim

                    Comment


                      #11
                      Tim,
                      I guess I just put too much faith in help files. In this case it says the numbering is from 0-255, but I guess it is really 1-256. (or maybe 255?) If the macro I really called had done something noticeable I would have picked up on it, but it didn't, and I wasn't watching the SG log like I should have been. So, it's at least partly my own fault.

                      I like your idea of putting the number in the name. It didn't occur to me because I hadn't tried to call one from HS before. (I also assumed I could call them by name.)

                      Thanks for you help.
                      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 would like to understand how to call a 'then macro' from HS.

                        From the prior discussion it seems that you have to call the 'then macro' as a number which is the number of the 'then macro' in the 'then macro' list in SG. I got that.

                        What's not clear is what code to use to call the then macro from HS.

                        Is this the code?

                        Sub Main
                        Dim oSG
                        Dim rval
                        Set oSG = hs.plugin("JDS StarGate")
                        rval = oSG.ThenMacro(10)
                        hs.WriteLog "Macro", rval
                        End Sub

                        thx -- greg

                        Comment


                          #13
                          Greg,
                          That's it. The WriteLog is optional, of course. Here's one of mine in VB.net. (Although it requires that variables be typed, it also allows them to be assigned in the same statement.)
                          Code:
                           Public Sub Main(ByVal Params As Object)
                          
                                  Dim intRval As Integer
                                  Dim oSG As Object = hs.Plugin("JDS StarGate")
                                  intRval = oSG.ThenMacro(6)
                          
                              End Sub
                          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


                            #14
                            Mike,

                            OK! Many thanks! I will take it for a spin.

                            -- greg

                            Comment

                            Working...
                            X