I must be missing something fundamental with scripting.. I have a script that can fetch the value of a light. Fine.
It also takes the current value and add 25 to it. Also fine.
But i cannot for the life of me figure out how to use CAPI to send the value back to the device?
I fount tenscripting and tenscriptingaid. But still.. i can use "on" and "off". But i can not figure out how to send a dim value??
Again, if i use
hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice, True, "on", False, False)) it works...
It also takes the current value and add 25 to it. Also fine.
But i cannot for the life of me figure out how to use CAPI to send the value back to the device?
I fount tenscripting and tenscriptingaid. But still.. i can use "on" and "off". But i can not figure out how to send a dim value??
Code:
Class BedroomSwipeToggleFloorLight Public Sub Main(ByVal theDevice As String) '' '' Toggle the Specified Device ON/OFF '' DIM is considered ON '' '' Specify the Device Name, including Locations, as a Parm Dim devValue As Double '' '' Get the Device Status devValue = hs.DeviceValue(theDevice) '' Toggle it hs.WriteLog("SampleScript", devValue.ToString) '@DONOTEXPORT Select Case devValue Case Is < 100 devValue = devValue + 25 hs.WriteLog("SampleScript", devValue.ToString) '@DONOTEXPORT If devValue > 99 Then devValue = 99 End If hs.WriteLog("SampleScript", devValue.ToString) '@DONOTEXPORT hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice, True, "99%", False, False)) #<-- This is what i cannot get working, no set of the "99" parameter regardles of casting etc gets me what i wantr. Case Is = 99 hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice, True, "off", False, False)) End Select End Sub End Class
hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice, True, "on", False, False)) it works...
Comment