Announcement

Collapse
No announcement yet.

Need Script help for Status Code Count

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

    Need Script help for Status Code Count

    So I have a whole house fan that I want to automatically start up when three windows are opened. I wanted to create a virtual device and vba code to update it depending on how many windows are open (I have 10). I cannot seem to get a devicestatus update from my windows to update the virtual drive. I am using the ELKM1G plugin to managed the windows statuses.

    Example:

    Front window open

    Dim icount
    icount=0
    Dim FrontWindow
    Frontwindow = hs.devicestatus("'17")

    IF Frontwindow = "Normal" Then
    icount +1
    End If

    hs.setdevicestatus "VirtualDevice", icount


    Any help would be appreciated.

    #2
    hs.setdevicestatus is only used for state e.g.
    0 = All Units Off
    2 = ON

    3 = OFF

    4 = DIM


    You will probaly need hs.setdevicevalue for this
    - Bram

    Send from my Commodore VIC-20

    Ashai_Rey____________________________________________________________ ________________
    HS3 Pro 3.0.0.534
    PIugins: ZMC audio | ZMC VR | ZMC IR | ZMC NDS | RFXcom | AZ scripts | Jon00 Scripts | BLBackup | FritzBox | Z-Wave | mcsMQTT | AK Ikea

    Comment


      #3
      Originally posted by leviathanxx View Post
      So I have a whole house fan that I want to automatically start up when three windows are opened. I wanted to create a virtual device and vba code to update it depending on how many windows are open (I have 10). I cannot seem to get a devicestatus update from my windows to update the virtual drive. I am using the ELKM1G plugin to managed the windows statuses.

      Example:

      Front window open

      Dim icount
      icount=0
      Dim FrontWindow
      Frontwindow = hs.devicestatus("'17")

      IF Frontwindow = "Normal" Then
      icount +1
      End If

      hs.setdevicestatus "VirtualDevice", icount


      Any help would be appreciated.
      Frontwindow = hs.devicestatus("'17") will only ever return 2, 3, 4 or 17 depending on on, off, dim or unknown (as AshaiRey says). You might find that your device instead uses to a value to store open or closed (say 0 for closed and 100 for open), you would need to check this first as every plugin stores it differently. You can then check this with hs.devicevalue.

      Comment

      Working...
      X