Announcement

Collapse
No announcement yet.

Web control of plugin

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

    Web control of plugin

    Mark

    I use the code (stub shown below) to control the alarm from a web page on my iPhone. It controls partition 1, now that I have two partitions, how would I go about controling partition 2? I have posted a picture of the page as well as the asp if you or anyone else has any interest.

    Thanks

    -rick

    If Request.Form("sVal17") = "Armed" Then
    hs.plugin("Vista Alarm").Armstay
    hs.waitsecs 1
    End If
    If Request.Form("sVal18") = "Chime" Then
    hs.plugin("Vista Alarm").ChimeMode
    hs.waitsecs 1
    End If
    If Request.Form("sVal19") = "Disarm" Then
    hs.plugin("Vista Alarm").Disarm
    hs.waitsecs 1
    End If
    Attached Files
    -Rick

    #2
    just added (1) or (2) after the method, like the following

    hs.plugin("Vista Alarm").Armstay(1) ' to arm P1
    hs.plugin("Vista Alarm").Armstay(2) ' to arm p2

    the same goes for the other calls in your script
    Mark

    HS3 Pro 4.2.19.5
    Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
    Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
    Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

    Comment


      #3
      Mark Adding (2) breaks the asp code.

      If Request.Form("sVal13a") = "Chest" Then
      if hs.DeviceValue("Q32") > 0 then
      hs.transmit "Q32", "Off", 0, 0
      hs.plugin("Vista Alarm").Armstay(2)
      hs.waitsecs 1
      Else
      hs.transmit "Q32", "On", 0, 0
      hs.plugin("Vista Alarm").Disarm(2)
      hs.waitsecs 1
      End If
      End If

      Here is the result:
      Script error: Exception from HRESULT: 0x800A01C2 hs.plugin("Vista Alarm").Armstay(2) hs.waitsecs 1 ' to arm P1

      -Rick
      -Rick

      Comment


        #4
        oops, this is vbscript not vb.net

        try
        hs.plugin("Vista Alarm").Armstay 2
        Mark

        HS3 Pro 4.2.19.5
        Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
        Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
        Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

        Comment


          #5
          Mark,

          same error more or less


          Script error: Exception from HRESULT: 0x800A01C2

          hs.plugin("Vista Alarm").Armstay 2
          hs.waitsecs 1

          -rick
          Last edited by rmorton27; March 4, 2012, 10:14 AM.
          -Rick

          Comment


            #6
            what plugin version are you running? i'll have to check the code
            Mark

            HS3 Pro 4.2.19.5
            Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
            Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
            Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

            Comment


              #7
              1.2.5.0
              -Rick

              Comment


                #8
                crap, it appears vbscript can't see the other function that allows parameters

                two choices:
                1. we add a vb.net script to take care of this (see below)
                2. i add new functions like disarmpartition, armawaypartition, etc that will accept a partition number. Not my favorite choice.

                so lets try #1

                unzip the attached to your homeseer\scripts folder. You will be adding alarmfunctions.vb to this folder. I tested this for partition 1 and it works.

                then modify your code like the following. Your code will call the vb.net code that will support the partition calls. Replace the "2" with "1" if you want partition 1 instead



                If Request.Form("sVal17") = "Armed" Then
                hs.runex "alarmfunctions.vb", "armaway", "2"
                hs.waitsecs 1
                End If

                If Request.Form("sVal18") = "Chime" Then
                hs.runex "alarmfunctions.vb", "chimemode", "2"
                hs.waitsecs 1
                End If

                If Request.Form("sVal19") = "Disarm" Then
                hs.runex "alarmfunctions.vb", "disarm", "2"
                hs.waitsecs 1
                End If
                Attached Files
                Mark

                HS3 Pro 4.2.19.5
                Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
                Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
                Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

                Comment


                  #9
                  Mark,

                  The script solution works, but its slow - 4 seconds without the wait. Any options? I had tried aspx but that too was really slow if not run recently.

                  -Rick
                  -Rick

                  Comment


                    #10
                    Yes, that is because of the delay we added to the vistaalarm.ini. you can try to trim that down by changing the WaitBetweenCmds=1.5 or 1.0, etc

                    test first from the plugin devices to make sure the delay isn't too small.
                    Mark

                    HS3 Pro 4.2.19.5
                    Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
                    Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
                    Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

                    Comment

                    Working...
                    X