Announcement

Collapse
No announcement yet.

Plugin script variables?

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

    Plugin script variables?

    I want to try my hand at creating a script that will announce which zone was tripped until I give the all clear (nothing more disconcerting than the alarm tripping at night and not knowing which zone it is).

    Is there and a post or docs somewhere I've missed that lists the HAI plugin variables?

    Thanks!
    Last edited by Wazoo; April 16, 2017, 02:07 PM.

    #2
    I dont have any variables exposed in the API. But, what you're wanting to do can be handled with regular HS scripting and looking at the devices.

    So, you would need to play around with the following:
    Click image for larger version

Name:	screenshot.png
Views:	1
Size:	40.2 KB
ID:	1190584

    Now, any time any of these zones are tripped, you will run this script to see which one it was:

    PHP Code:
    Sub Main(ByVal Parm as Object)

    Dim speakSomething as String ""
    Dim dev As Scheduler.Classes.DeviceClass

    If(hs.deviceString(1234)="NOT READY")) then
         dev 
    hs.GetDeviceByRef(1234)
         
    speakSomething "Zone " dev.Name(hs" & was tripped"
    end if

    If(
    hs.deviceString(2345)="NOT READY")) then
         dev 
    hs.GetDeviceByRef(1234)
         
    speakSomething "Zone " dev.Name(hs" & was tripped"
    end if

    If(
    hs.deviceString(3456)="NOT READY")) then
         dev 
    hs.GetDeviceByRef(1234)
         
    speakSomething "Zone " dev.Name(hs" & was tripped"
    end if

    End Sub 
    Note that you need to specify "Do not run for xx seconds" to keep it from spamming your speaker clients.

    This code is untested and you'll need to play around with it for your system - replace the device references with yours.

    Let me know how it goes.

    Thanks
    Rob
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    Comment

    Working...
    X