Need some help with this script. It changes the value on the device but the device does not turn on/of when ran.
Sub Main(ByVal Parms 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
Dim theDevice As String
'' Get Device from the Parms
theDevice = Parms.ToString
'' Get the Device Status
devValue = hs.DeviceValueByName(theDevice)
'' Toggle it
Select Case devValue
Case Is > 0
'' Device ON or DIM, turn it OFF
hs.SetDeviceValueByName(theDevice, 0)
hs.SetDeviceStringByName(theDevice, "Off", True)
Case 0
'' Device OFF, turn it ON
hs.SetDeviceValueByName(theDevice, 255)
hs.SetDeviceStringByName(theDevice, "On", True)
End Select
End Sub
Sub Main(ByVal Parms 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
Dim theDevice As String
'' Get Device from the Parms
theDevice = Parms.ToString
'' Get the Device Status
devValue = hs.DeviceValueByName(theDevice)
'' Toggle it
Select Case devValue
Case Is > 0
'' Device ON or DIM, turn it OFF
hs.SetDeviceValueByName(theDevice, 0)
hs.SetDeviceStringByName(theDevice, "Off", True)
Case 0
'' Device OFF, turn it ON
hs.SetDeviceValueByName(theDevice, 255)
hs.SetDeviceStringByName(theDevice, "On", True)
End Select
End Sub
Comment