Announcement

Collapse
No announcement yet.

HS3 Scripting Turn On Insteon Device

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

    HS3 Scripting Turn On Insteon Device

    Hello Everyone,

    I am trying to turn on an Insteon device based on a motion sensor device and using BLRadar.

    So, BLRadar is correctly calling the script below using the following arguments:
    hs.RunScriptFunc("Test.vb","ZoneChange","Laundry|Occupied",f alse,false)

    --------------------------------------------------
    Sub ZoneChange(ByVal Parms As Object)
    Dim ParmsArray() As String
    ParmsArray = Parms.ToString.Split("|")
    Dim ZoneName As String = ParmsArray(0)
    Dim ZoneStatus As String = ParmsArray(1)
    If ZoneName = "Laundry" Then
    Dim InsteonGroupLightsInLaundry As String = "24.04.3A:1"
    'Dim InsteonGroupLightsInLaundry As String = "Group:7"
    If ZoneStatus = "Occupied" Then
    hs.WriteLog("Debug", "Laundry Room - Occupied")
    hs.SetDeviceValue("InsteonGroupLightsInLaundry", 2)
    End If
    If ZoneStatus = "Vacant" Then
    hs.WriteLog("Debug", "Laundry Room - Vacant")
    hs.SetDeviceValue("InsteonGroupLightsInLaundry", 0)
    End If
    End If
    End Sub
    ----------------------------------------------------------
    I see the Debug output, but the device does not turn on. What am I doing wrong?

    Thanks,

    Marcus

    #2
    Setting the device value does not control the device. You must use CAPI to control the device directly, or use hs.triggerEvent to trigger an event that controls the device.

    Sent from my Xoom using Tapatalk 4
    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


      #3
      Great!

      I have update my script, but now it is giving me a syntax error?

      Any idea?

      Thank you very much,

      Marcus

      Sub ZoneChange(ByVal Parms As Object)
      Dim ParmsArray() As String
      ParmsArray = Parms.ToString.Split("|")
      Dim ZoneName As String = ParmsArray(0)
      Dim ZoneStatus As String = ParmsArray(1)
      If ZoneName = "Laundry" Then
      Dim InsteonGroupLightsInLaundry As String = "24.04.3A:1"
      'Dim InsteonGroupLightsInLaundry As String = "Group:7"
      If ZoneStatus = "Occupied" Then
      hs.WriteLog("Debug", "Laundry Room - Occupied")
      'hs.SetDeviceValue("InsteonGroupLightsInLaundry", 2)
      hs.CAPIControlHandler(hs.CAPIGetSingleControl(InsteonGroupLi ghtsInLaundry,true,"on",false,true))
      End If
      If ZoneStatus = "Vacant" Then
      hs.WriteLog("Debug", "Laundry Room - Vacant")
      'hs.SetDeviceValue("InsteonGroupLightsInLaundry", 0)
      hs.CAPIControlHandler(hs.CAPIGetSingleControl(InsteonGroupLi ghtsInLaundry,true,"off",false,true))
      End If
      End If
      End Sub

      Comment


        #4
        I figured it out. It is working now.

        hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRe fByName("Load Control Laundry Main Lights"), True, "on", False, True))


        Thanks,

        Marcus

        Comment

        Working...
        X