I could probably clean that code up to use a function call for testing and setting each item. I was in a hurry when I wrote it. Got it working for one and copied it for the rest. Would probably look like this (UNTESTED!):
Code:
Sub Main(Parms As Object) ' hs.writelog("Parameter Test",CInt(Parms(0))) 'Ceiling Fan TestSet("Ceiling Fan Light Selector", "Ceiling Fan Light") 'Fireplace Outside Cans TestSet("HSTouch -Fireplace Outside Cans Selector", "Fireplace Outside Lights") 'Fireplace Inside Cans TestSet("Fireplace Inside Lights", "HSTouch -Fireplace Inside Cans Selector") 'Entrance Light TestSet("Entrance Light @ Door", "HSTouch - Foyer Selector") 'Light Outside Powder Room TestSet("Light Outside Powder Room", "HSTouch - Light Outside Powder Room Selector") 'Stairs Light TestSet("HSTouch - Stairs Light Selector","Main Stairs Lights @ Top of Steps") End Sub Sub TestSet(byRef Selector as String, byRef Device as String) Dim SelectorRef As Integer Dim DevRef As Integer 'Get the Device References SelectorRef = hs.GetDeviceRefByName(Selector) DevRef = hs.GetDeviceRefByName(Device) 'Set the Device Value if the Device Selector is selected. If hs.IsOn (SelectorRef) then hs.CAPIControlHandler(hs.CAPIGetSingleControl(DevRef,false,CInt(Parms(0)),false,true)) end if End Sub
Comment