I can't seem to get this to work. I'm using VBscript, here's the script:
------
sub main()
dvRef = hs.GetDeviceRefByName("Jerry's Office")
hs.writelog "dvRef", dvRef
objCAPIControl = hs.CAPIGetSingleControlByUse(77, 2)
hs.writelog "objCAPIControl", objCAPIControl
hs.CAPIControlHandler objCAPIControl
end sub
------
The log output is:
Obviously, the device is found (ref # 77), and I think the CAPI control object is found (CAPI+CAPIControl), though I don't know what CAPI+CAPIControl means. But the call to hs.CAPIControlHandler doesn't work. (Note that in VB script, there's no need for parens here).
The Device is a UPB light switch, a "UPB Device" imported through UPBSpud. I can control the device normally through the Device page interface.
Note also that the script interpreter objects to the underscore as an "invalid character" if I try this:
objCAPIControl = hs.CAPIGetSingleControlByUse(dvRef,ePairControlUse._On)
...so I substituted the value for "off" (2, supposedly). Quoting the value as a string doesn't work either.
I've spent hours trying everything to no avail. Any advice appreciated!
Jerry
Current Date/Time: 6/18/2019 1:21:49 PM
HomeSeer Version: HS3 Standard Edition 3.0.0.534
Operating System: Microsoft Windows 10 Pro - Work Station
System Uptime: 0 Days 0 Hours 47 Minutes 42 Seconds
IP Address: 192.168.1.101
Number of Devices: 155
Number of Events: 60
Available Threads: 200
HSTouch Enabled: True
Event Threads: 0
Event Trigger Eval Queue: 0
Event Trigger Priority Eval Queue: 0
Device Exec Queue: 0
HSTouch Event Queue: 0
Email Send Queue: 0
Anti Virus Installed: Windows Defender
In Virtual Machine: No MFG: dell inc.
Enabled Plug-Ins
3.0.6681.34300: UltraCID3
3.0.0.50: UPBSpud
3.0.0.36: X10
------
sub main()
dvRef = hs.GetDeviceRefByName("Jerry's Office")
hs.writelog "dvRef", dvRef
objCAPIControl = hs.CAPIGetSingleControlByUse(77, 2)
hs.writelog "objCAPIControl", objCAPIControl
hs.CAPIControlHandler objCAPIControl
end sub
------
The log output is:
Jun-18 1:08:54 PM | Error | Running script, script run or compile error in file: C:/Program Files (x86)/HomeSeer HS3/scripts/test.txt5:Invalid procedure call or argument: 'hs.CAPIControlHandler' in line 10 More info: Invalid procedure call or argument: 'hs.CAPIControlHandler' |
Jun-18 1:08:54 PM | objCAPIControl | HomeSeerAPI.CAPI+CAPIControl |
Jun-18 1:08:54 PM | dvRef | 77 |
Jun-18 1:08:54 PM | Event | Running script in background: C:/Program Files (x86)/HomeSeer HS3/scripts/test.txt |
Jun-18 1:08:54 PM | Event | Event Trigger "misc Test turn a light off/on by script" |
Jun-18 1:08:54 PM | Event | Event misc Test turn a light off/on by script triggered by the event page 'Run' button. |
Obviously, the device is found (ref # 77), and I think the CAPI control object is found (CAPI+CAPIControl), though I don't know what CAPI+CAPIControl means. But the call to hs.CAPIControlHandler doesn't work. (Note that in VB script, there's no need for parens here).
The Device is a UPB light switch, a "UPB Device" imported through UPBSpud. I can control the device normally through the Device page interface.
Note also that the script interpreter objects to the underscore as an "invalid character" if I try this:
objCAPIControl = hs.CAPIGetSingleControlByUse(dvRef,ePairControlUse._On)
...so I substituted the value for "off" (2, supposedly). Quoting the value as a string doesn't work either.
I've spent hours trying everything to no avail. Any advice appreciated!
Jerry
Current Date/Time: 6/18/2019 1:21:49 PM
HomeSeer Version: HS3 Standard Edition 3.0.0.534
Operating System: Microsoft Windows 10 Pro - Work Station
System Uptime: 0 Days 0 Hours 47 Minutes 42 Seconds
IP Address: 192.168.1.101
Number of Devices: 155
Number of Events: 60
Available Threads: 200
HSTouch Enabled: True
Event Threads: 0
Event Trigger Eval Queue: 0
Event Trigger Priority Eval Queue: 0
Device Exec Queue: 0
HSTouch Event Queue: 0
Email Send Queue: 0
Anti Virus Installed: Windows Defender
In Virtual Machine: No MFG: dell inc.
Enabled Plug-Ins
3.0.6681.34300: UltraCID3
3.0.0.50: UPBSpud
3.0.0.36: X10
Comment