Mac Mini remote power button
Post ReplyMac Mini remote power buttonPosted: Wednesday, March 2, 2011 [18:59:07] - 1
This is one of the ways to remotely control Mac Mini's power button. In rare case of power outage and Power BackUPs depletion Mac can be brought back up by Power Settings "Energy Saver -> Schedule -> Start or wake" if Mac is in high demand - it could be booted by physically pressing Power button. In my case other Mac Mini checks every hour weather or not main Mac is up or down and if it is not powered-up - it uses a Phidgets Servo controller: http://www.phidgets.com Any servo that is small enough could be used to press the power button. All that has to be done is gluing it in proper position I used Elmer's Glue-All white multi purpose glue In 24 hours it hardens and holds servo in-place with enough force for power button to be pressed will continue once glue is set. |
RE: Mac Mini remote power buttonPosted: Saturday, July 20, 2019 [00:45:47] - 2
Posted by:John H.Posts: 1 | Does it work? Do you have a code to control it? Thanks |
RE: Mac Mini remote power buttonPosted: Saturday, October 3, 2020 [02:07:40] - 3
Yes, it works. Sorry for the delay in answer. Code depends on how you control servo. Depends on OS and weather it used by GPIO or USB controller. In case here AppleScript is used to control Phidgets Servo module. I.e. Python code to control it: """Copyright 2010 Phidgets Inc. This work is licensed under the Creative Commons Attribution 2.5 Canada License. To view a copy of this license, visit creativecommons.org/licen.. """ __author__ = 'Adam Stelmack' __version__ = '2.1.8' __date__ = 'May 17 2010' #Basic imports from ctypes import * import sys from time import sleep #Phidget specific imports from Phidgets.PhidgetException import PhidgetException from Phidgets.Devices.Servo import Servo, ServoTypes #Create an servo object try: servo = Servo() except RuntimeError as e: print("Runtime Exception: %s" % e.details) print("Exiting....") exit(1) #Information Display Function def DisplayDeviceInfo(): print("|------------|----------------------------------|--------------|------------|") print("|- Attached -|- Type -|- Serial No. -|- Version -|") print("|------------|----------------------------------|--------------|------------|") print("|- %8s -|- %30s -|- %10d -|- %8d -|" % (servo.isAttached(), servo.getDeviceName(), servo.getSerialNum(), servo.getDeviceVersion())) print("|------------|----------------------------------|--------------|------------|") print("Number of motors: %i" % (servo.getMotorCount())) #Event Handler Callback Functions def ServoAttached(e): attached = e.device print("Servo %i Attached!" % (attached.getSerialNum())) def ServoDetached(e): detached = e.device print("Servo %i Detached!" % (detached.getSerialNum())) def ServoError(e): try: source = e.device print("Servo %i: Phidget Error %i: %s" % (source.getSerialNum(), e.eCode, e.description)) except PhidgetException as e: print("Phidget Exception %i: %s" % (e.code, e.details)) def ServoPositionChanged(e): source = e.device print("Servo %i: Motor %i Current Position: %f" % (source.getSerialNum(), e.index, e.position)) #Main Program Code try: servo.setOnAttachHandler(ServoAttached) servo.setOnDetachHandler(ServoDetached) servo.setOnErrorhandler(ServoError) servo.setOnPositionChangeHandler(ServoPositionChanged) except PhidgetException as e: print("Phidget Exception %i: %s" % (e.code, e.details)) print("Exiting....") exit(1) print("Opening phidget object....") try: servo.openPhidget() except PhidgetException as e: print("Phidget Exception %i: %s" % (e.code, e.details)) print("Exiting....") exit(1) print("Waiting for attach....") try: servo.waitForAttach(10000) except PhidgetException as e: print("Phidget Exception %i: %s" % (e.code, e.details)) try: servo.closePhidget() except PhidgetException as e: print("Phidget Exception %i: %s" % (e.code, e.details)) print("Exiting....") exit(1) print("Exiting....") exit(1) else: DisplayDeviceInfo() try: print("Setting the servo type for motor 0 to HITEC_HS322HD") servo.setServoType(0, ServoTypes.PHIDGET_SERVO_HITEC_HS322HD) # POSITION ON print("Move to position 65.00") servo.setPosition(0, 28.00) sleep(1) # POSITION NEUTRAL print("Move to position 90.00") servo.setPosition(0, 90.00) sleep(1) except PhidgetException as e: print("Phidget Exception %i: %s" % (e.code, e.details)) print("Exiting....") exit(1) print("Closing...") try: servo.closePhidget() except PhidgetException as e: print("Phidget Exception %i: %s" % (e.code, e.details)) print("Exiting....") exit(1) exit(0) There could be many other ways to control servo. |