I needed a way to control the garage door, mainly for runnng past a PE beam on the way up the driveway. The following code seems to be working for me as I don't have access (at least until uthe warranty runs out) to the up/down/stop buttons on the garage door controller. For some reason I only get a dodgy set of dry contacts to play with. I've also installed a reed for the alarm system to detect when the door is closed or open. The script is event based and runs when the GARAGE DOOR TRIGGER is pulsed. Code: -- Read the value of the Garage Door Trigger value = event.getvalue() if (value > 0) then log('Garage Door Trigger Activated') --log(mail('[email protected]', 'CBUS ALERT', 'Attempts to close the Garage Door have failed. Garage is currently in the OPEN state.')) reed_state = GetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR REED') -- If the door is closed (ie, reed switch contacts closed if (reed_state == 255) then log('Door Closed Sending Pulse Commamnd') -- Using following rather than Pulse as it didn't seem to actually work SetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR', 255, 0) os.sleep(2) SetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR', 0, 0) -- If door is closed, wait 10 seconds to see if reed state changes os.sleep(10) -- Read the garage door reed switch again reed_state = GetCBusLevel(0, 56, 'GARAGE DOOR REED') -- If the door is still closed (ie, reed switch contacts closed if (reed_state == 255) then -- If the door is still closed, (this should never happen unless there is a fault) give it another try log('Door still closed, sending another pulse') SetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR', 255, 0) os.sleep(2) SetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR', 0, 0) end else log('Door Open sending pulse command') SetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR', 255, 0) os.sleep(2) SetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR', 0, 0) -- Wait for 25 seconds for door to fully close (normally withing 18-20 sec os.sleep(25) reed_state = GetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR REED') if (reed_state == 0) then -- If the door is stil open, it may have been waiting for the next pulse to go UP -- There may also be an obstruction, but try again log('Door still open sending pulse command') SetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR', 255, 0) os.sleep(2) SetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR', 0, 0) -- Lets wait again and check it in 50 seconds accounting that the door may have to go all -- the way down and then up again if there is an obsruction os.sleep(50) reed_state = GetCBusLevel('Local Network', 'Lighting', 'GARAGE DOOR REED') if (reed_state == 0) then -- Something messed up, send an email, alert, whatever -- Could be faulty unit, obstruction, etc log(mail('[email protected]', 'CBUS ALERT', 'Attempts to close the Garage Door have failed. Garage is currently in the OPEN state.')) end end end end