Announcement

Collapse
No announcement yet.

HS2: Adding custom btns to the Vista Alarm plugin

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

    HS2: Adding custom btns to the Vista Alarm plugin

    Raven,

    I thought i would start a new thread for this topic.

    Attached is a vb.net script. unzip it to your \scripts folder. You need to make a few changes:
    1. change the *98 code to your code
    2. Change the "1" in the SendToAlarm to the night mode sequence

    Code:
    Imports HSPI_VISTAALARM 
    
    rem this is what gets executed when you click the btn
    Sub NightMode(parms as object) 
          Dim VA As Object
          VA = hs.Plugin("Vista Alarm") 
          
          rem change 1 to the seq you need, this cmd assumes the first thing to send in the panel code, which will happen automatically, ie don't add your code
           VA.SendToAlarm("1", "Night Mode")
    	
           VA = nothing 
    End Sub
    
    rem this only need to be run once to add the button
    sub AddNightModeBtn(parms as object)
    
          rem change *98 to your device code
          hs.devicebuttonRemove ("*98", "Night Mode")
    
          hs.devicebuttonAdd("*98", "vistaalarmextras.vb(""NightMode"", """")", "Night Mode"+CHR(4))
    
    end Sub

    3. from the hs control\Immediate Script Command window, execute the following. this will add a Night Mode btn to device 98.

    Code:
    hs.runex "vistaalarmextras.vb" ,"AddNightModeBtn" ,""
    You should then see the Night Mode btn.

    4. Click to test.

    One note about the placement of the new btn: the btn will not be vertically aligned like the existing btns. i will fix this in the next version of the plugin.
    Attached Files
    Last edited by mnsandler; December 29, 2013, 09:45 AM.
    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

    #2
    To simulate Btn A, change

    VA.SendToAlarm("1", "Night Mode")

    to

    VA.SendToAlarm(chr(1), "Button A, or any text you want to show in the log")

    for Btn B use chr(2)
    for Btn C use chr(3)
    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
      Originally posted by mnsandler View Post
      To simulate Btn A, change

      VA.SendToAlarm("1", "Night Mode")

      to

      VA.SendToAlarm(chr(1), "Button A, or any text you want to show in the log")

      for Btn B use chr(2)
      for Btn C use chr(3)
      Hi Mark,

      just to clarify, when you say change to your code

      1. the *98 code to your code
      2. Change the "1" in the SendToAlarm to the night mode sequence

      1 = is the panel code to activate the night mode?

      2 = ? can you give an example?

      Thanks
      Last edited by Raven_; July 21, 2009, 02:30 PM.

      Comment


        #4
        Originally posted by Raven_ View Post
        Hi Mark,

        just to clarify, when you say change to your code

        1. the *98 code to your code
        2. Change the "1" in the SendToAlarm to the night mode sequence

        1 = is the panel code to activate the night mode?

        2 = ? can you give an example?

        Thanks
        1. *98 is the code of my "system status" device on the status page, i think yours is ]98. please verify on your status page then change the line i referenced above.

        Note: in homeseer, the housecode (ie the first character of a "code" on the status page) can be different for each installation.

        2. i think you said Btn A is your Night Mode btn, so change the line i mentioned above to

        Code:
        VA.SendToAlarm(chr(1), "Night Mode")
        With debug mode on, when you hit your custom Night Mode button you will see the following in the log

        "Sending Night Mode command to the alarm"
        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
          Hi Mark,
          I know this is a old sticky but I'm finally getting around to adding additional buttons to the plug-in. I followed the directions in this sticky and have successfully created a Night Mode button using the script command below.
          I'm trying to activated Keypad button "D" which is a programmed Marco in the alarm system that requires [Command] + [Code] being send to the panel. Below is what I'm using. I just can't seem get this working. Any ideas?
          Thanks
          Jim

          PHP Code:
          Imports HSPI_VISTAALARM 
          rem this is what gets executed when you click the btn
          Sub NightMode
          (parms as object
            
          Dim VA As Object
            VA 
          hs.Plugin("Vista Alarm"
           
           
          rem change 123 to the seq you needthis cmd assumes the first thing to send in the panel codewhich will happen automaticallyie don't add your code
            VA.SendToAlarm("D", "Night Mode")
           
           VA = nothing 
          End Sub
           
          rem this only need to be run once to add the button
          sub AddNightModeBtn(parms as object)
            hs.devicebuttonRemove ("#98", "Night Mode")
            hs.devicebuttonAdd("#98", "vistaalarmextras.vb(""NightMode"", """")", "Night Mode"+CHR(4))
          end Sub 
          Running HSPRO2 Vista Plug-in Version v1.2.15.0

          Comment


            #6
            I think "D" is the problem. i think you need to replace it with

            chr(4) without quotes so the call should look like

            va.sendtoalarm(chr(4), "Night Mode") ' chr(4) is converted to btn D via the ad2usb
            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
              Originally posted by mnsandler View Post
              I think "D" is the problem. i think you need to replace it with

              chr(4) without quotes so the call should look like

              va.sendtoalarm(chr(4), "Night Mode") ' chr(4) is converted to btn D via the ad2usb
              Thanks Mark. Just tried it but no joy. How do a change the script to send the command first then send the security code.

              This is what I get with the above script line when I push the "Night Mode" button a created in device #98 of the plug-in (debugging is on).

              PHP Code:
              12/8/2013 2:32:18 PM Vista Alarm !Sending.done
              12
              /8/2013 2:32:18 PM Vista Alarm Sending [code]+ 

              Comment


                #8
                try

                va.sendtoalarm(chr(4)+chr(4)+chr(4), "Night Mode") '

                I recall Sean changed this in some ad2usb fw that the cmd must be repeated three times.

                to send security code with the cmd do the following

                va.sendtoalarm(chr(4)+chr(4)+chr(4), "Night Mode", "1234") ' where 1234 is your 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


                  #9
                  Originally posted by mnsandler View Post
                  try

                  va.sendtoalarm(chr(4)+chr(4)+chr(4), "Night Mode") '

                  I recall Sean changed this in some ad2usb fw that the cmd must be repeated three times.

                  to send security code with the cmd do the following

                  va.sendtoalarm(chr(4)+chr(4)+chr(4), "Night Mode", "1234") ' where 1234 is your code
                  Thanks Mark!!!! It works perfectly.
                  I used the following commands:

                  va.sendtoalarm(chr(4)+chr(4)+chr(4), "Night Mode")

                  and then had to send a second separate command to make it work

                  va.sendtoalarm("1234") ' where 1234 is my panel code.

                  See code below; hope its helpful to others who are trying to activate a alarm panel macro from Keypad buttons A,B, C or D.

                  Thanks again Mark

                  Jim
                  PHP Code:
                  Imports HSPI_VISTAALARM 
                  rem this is what gets executed when you click the btn
                  Sub NightMode
                  (parms as object
                    
                  Dim VA As Object
                    VA 
                  hs.Plugin("Vista Alarm"
                   
                   
                   
                  va.sendtoalarm(chr(4)+chr(4)+chr(4), "Night Mode"
                    
                  va.sendtoalarm("1234")
                   
                   
                  VA nothing 
                  End Sub
                   
                  rem this only need to be run once to add the button
                  sub AddNightModeBtn
                  (parms as object)
                    
                  hs.devicebuttonRemove ("#98""Night Mode")
                    
                  hs.devicebuttonAdd("#98""vistaalarmextras.vb(""NightMode"", """")""Night Mode"+CHR(4))
                  end Sub 

                  Comment


                    #10
                    Well that was easy. Take care.

                    I'm knee deep in porting this plugin to HS3...trying to get something posted this month, ugh!
                    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


                      #11
                      Originally posted by mnsandler View Post
                      Well that was easy. Take care.

                      I'm knee deep in porting this plug-in to HS3...trying to get something posted this month, ugh!
                      I can only imagine how much work that is. I'll be moving over to HS3 next month so hopefully I can get things up and running to help test your plug-in.

                      Again thanks and Have a Merry Christmas.

                      Jim

                      Comment

                      Working...
                      X