Announcement
Collapse
No announcement yet.
CAPI for idiots like me
Collapse
X
-
You can read the existing value using hs.DeviceValue and then increase/decrease the number that is returned by it before setting the device using CAPI. Here's a code snippet that should get you started (this increases is by 5):
Code:devValue = hs.DeviceValue(targetDev) newDevValue = devValue + 5 hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev, false, CStr(newDevValue), false, true))
Cheers
AlHS 4.2.8.0: 2134 Devices 1252 Events
Z-Wave 3.0.10.0: 133 Nodes on one Z-Net
-
Originally posted by rmorton27 View Post. . .and the CAPI stuff really gives me conniptions.
I do see some wonderful potential in HS3 buts it's tough getting there from a mature HS2 system.
Regarding CAPI, are you familiar with the TenScriptAid tool? If not, I'd recommend you try it. It's an excellent way to gain insight into CAPI commands.Mike____________________________________________________________ __________________
HS3 Pro Edition 3.0.0.548, NUC i3
HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti
Comment
-
Uncle Michael - Thanks, I had started some time ago down that route and got distracted with other Alligators, I will make the effort, though...
Sparkman, again you pointed the way forward and I now have a working prototype only the first two rows work but they work! Not too happy with my layout but that just exposes another weak point in my abysmal skills.
Thanks again.-Rick
Comment
-
Originally posted by rmorton27 View PostSparkman, again you pointed the way forward and I now have a working prototype only the first two rows work but they work! Not too happy with my layout but that just exposes another weak point in my abysmal skills.
Thanks again.
Cheers
AlHS 4.2.8.0: 2134 Devices 1252 Events
Z-Wave 3.0.10.0: 133 Nodes on one Z-Net
Comment
-
Hi,
I have taken the suggestion to try out TenScriptAid and I can see its utility. It gives new insights. However, with this knowledge comes new challenges because it gives code snippets in vb. For example, I have discovered decisive that I have the same problem that many have had with Z-Wave thermostats that you can set the set points but they don't result in convincing the thermostat to execute them. TenScripAid can interrogate the thermostats (HS3) setpoint, it generates the code stub and it works.
Dim cc as HomeSeerAPI.CAPI.CAPIControl = hs.CAPIGetSingleControl(111, True, "(value) F", False, False)
cc.ControlValue = 74
Dim cr as HomeSeerAPI.CAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
My new problem that I am confronted with is to try and translate the VB code into VBScript. I wonder if someone might be able to show me the way with this snippet to unwind the VB into VBScript?
-Rick-Rick
Comment
-
Hello,
I use this script to set my Heating Setpoint in my Zwave thermostat SRT323:
Sub Main(ByVal Parm As Object)
dim Value_temp as double
Value_temp = Parm
Dim cc as HomeSeerAPI.CAPI.CAPIControl = hs.CAPIGetSingleControl(hs.GetDeviceRefByName("Regulation Chauffage Couloir Haut Heating Setpoint"), True, "(value) C", False, False)
cc.ControlValue = Value_temp
Dim cr as HomeSeerAPI.CAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
Log("Valeur SetPoint Etage" & cr)
End Sub
Sub Log(ByVal ParStr As String)
hs.WriteLog("Thermostat", ParStr)
End Sub
Jean-Francois
Comment
-
Seeing Jean-Francois suggestion gave me an idea. Could I call this vb routine from my asp page, so I created a file called SetHeat.vb in my script folder based on tenScriptAid and Jean-Francois's samples.
Sub Main(ByVal Parm As Object)
dim Value_temp as double
Value_temp = Parm
Dim cc as HomeSeerAPI.CAPI.CAPIControl = hs.CAPIGetSingleControl(111), True, "(value) F", False, False)
cc.ControlValue = Value_temp
Dim cr as HomeSeerAPI.CAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
End Sub
This is my asp code
theDevice = 111
devValue = hs.DeviceValue(theDevice)
devValue=devValue+1
if devValue > 81 then devValue=72
if devValue < 59 then devValue=72
newDevValue=devValue
hs.runscriptfunc "SetHeat.vb", "Main",newDevValue
and I get an error in my asp page when I clik the button that assigns this value.
Script error: Invalid procedure call or argument: 'hs.runscriptfunc'
hs.runscriptfunc "SetHeat.vb", "Main",newDevValue
hs.writelog "increase heat setpoint",cstr(newDevValue)
So I wonder if anyone can point out the problem?
-Rick-Rick
Comment
-
Runscriptfunc has 5 parameters so try:
hs.runscriptfunc "SetHeat.vb", "Main",newDevValue, false, false
http://homeseer.com/support/homeseer...scriptfunc.htm
Comment
-
I'm beyond excited. With tenScriptAid and this bit of magic from jon00, I can now set the setpoints for thermostats and I image most any CAPI device. While I am still very much in the dark about vb.net syntax CAPI and all of that I have a way to actually do stuff and not be the pain the ***. I hope this exuberance ins;t short lived...
My ASP:
theDevice = 111
devValue = hs.DeviceValue(theDevice
devValue=devValue+1
if devValue > 81 then devValue=72
if devValue < 59 then devValue=72
newDevValue=devValue
hs.runscriptfunc "SetHeat1.vb", "Main",newDevValue, false,
My VB.net:
Sub Main(ByVal Parm As Object)
dim Value_temp as double
Value_temp = Parmhs.writelog("fromsetheat1",cstr(Value_temp))
Dim cc as HomeSeerAPI.CAPI.CAPIControl = hs.CAPIGetSingleControl(111, True, "(value) F", False, False)
cc.ControlValue = Value_temp
Dim cr as HomeSeerAPI.CAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
End Sub
Note tenScriptAid creates these code snip with constants so I replaced it with Value_temp and all seems good.-Rick
Comment
Comment