Announcement

Collapse
No announcement yet.

Custom message script problem

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

    #16
    Glad to help. Thanks for testing the latest betas and posting feedback.
    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


      #17
      Mark,

      Everything seems pretty stable and working as intended. I was never able to achieve the goal if firing the script reliably once just using the custom message with the partition hack active in the panel. I ended with a two-part solution. I changed the event conditions and added a test to the virtual device that is set to 0 when the panel is armed. The script when the custom trigger is seen then sets this virtual device to on. So when the custom trigger message is bouncing from one partition to the other the condition won't be true and the script won't re-trigger until I set the virtual device to off. So all is good.

      On a dumb question. You zinged (no worries and I am grateful you take the time) me on my code for my ifs in the for next loop and pointed out a more elegant method. Aside from butcher rick (which I am) is there any real benefit to be gained on a twice and done loop?

      Code:
      sub main()
      
      hs.writelog "Alarm Tripped","The Script has been initiated." 
      
      if hs.DeviceValue(566) = 0 then 
      	hs.SetDeviceValueByRef 566,1,True  ' we don't want this script to rerun 
      
      	for x = 1 to 2
      	
      		if x = 1 then seconds=60
      		if x = 2 then seconds=30
      		If hs.devicevalue(269) <> 1 then
      			hs.speak "The alarm has detected entry and the siren will activate in less than "& cstr(seconds) & " seconds.",true,"*:*"
      			hs.waitsecs 1
      			hs.speak "Proceed to nearest keypad and enter your code.",true,"*:*"
      			hs.waitsecs 1
      		end if	
      	
      	
      		If hs.devicevalue(269) <> 1 then
      			hs.speak "The home's perimeter video system recorded your approach and entry, that recording is now in the cloud.",true,"*:*" 
      			hs.waitsecs 1
      		end if
      
      
      		if hs.devicevalue(269) <> 1 then 
      			hs.speak "Upon siren activation the police will be notified and these recordings will be provided.",true,"*:*"
      			hs.waitsecs 1
      		end if
       
      
      	next 
      		if hs.devicevalue(269) <> 1 then 
      			hs.speak "Siren activation imminent.",true,"*:*"
      		end if
      
      end if 
      
      hs.writelog "Alarm Tripped","The Script has completed."
      
      end sub
      And this is the script that runs once the pane;l is disarmed.
      Attached Files
      -Rick

      Comment


        #18
        Rick,

        you probably don't even need a loop based on what you are doing.

        you could probably just create a function that accepts 'seconds' as an input and then call the routine twice

        dostuff(30)

        dostuff(60)

        sub dostuff(seconds as integer)
        end sub
        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