TweetFollow Us on Twitter

PowerKey Pro 600

Volume Number: 13 (1997)
Issue Number: 12
Column Tag: Tools of the Trade

PowerKey Pro 600

by Christopher Hall

This is not your father's powerstrip... A look at the latest in computer automation technology

Figure 1. Sophisticated Cicuits' PowerKey Pro 600.

That Special Morn

It's a special holiday morning and gift wrapping is flurrying as the gadgets and gizmos are ripped open by eager hands. As the children shriek over their eMates and the adults wince at their credit card bills, what should an intrepid Mac System Administrator find as his gift but... a power strip?

"They couldn't get me a tie or cummerbund or something else I don't need? My gift's another power strip?" our heroic Mac loyalist laments ungratefully. With a brave eye, he slowly opens the elegant biodigradable cardboard box to look at Sophisticated Circuits' newest toy, the PowerKey Pro Model 600.

Rummaging thru the box's contents, our Holiday Geek wonders, "Why would a power strip have such a strange ADB cable? And two RJ-11 phone jacks? And software?" Rushing to his Mac, he excitedly installs the software, shuts down, and moves all of his power cords from his brain-dead power strip to the suddenly fascinating PowerKey.

Perhaps this happy scenario will be repeated for many users this year, because the PowerKey Pro 600 is one of the most useful geegaws a Macintosh-using Inspector Gadget could receive. Under the mild-mannered guise of a handsome power strip, the PK Pro 600 hides a powerhouse power controller with all the smarts needed to control its six outlets from your Macintosh by keystroke, schedule, telephone or AppleScript.

What Can It Do - The Basics

As an intelligent power strip, the PowerKey Pro 600 can do simple and useful tasks; even merely starting up the Mac can be enhanced. Older Macs which lack "soft" power (that is, keyboard power on, such as a Power Mac 6100 series lacks), can now enjoy that convenience. Furthermore, if a system has many peripherals to be started up before the CPU (such as hard disks with a lengthy spin up), setting the CPU's outlet with a delay allows true one-touch startup.

Starting up or shutting down on a schedule, as well as saving energy by powering down an idle Mac's monitor, is also easy with the PowerKey's very well-designed software.

Setup and Use

Setting up the PowerKey is a breeze. The hardware requires nary a moment of thought to properly hook ADB, the phone and the power cords together, while the software requires little more than a reboot and some preference setting. Sophisticated Circuits has wisely given a switch for each outlet, the ability to disable the switches and, for the careless scripter who PowerKey's his Mac into not being able to boot, a simple hardware override.

Figure 2. Hardware Setup of the PowerKey Pro.

The PowerKey Editor is the interface to the PowerKey Extension, the background-only application that does the real work. A simple Schedule window shows all the events created for a given PowerKey. Considering that multiple PowerKey Pros can be daisychained over ADB, this control is appreciated for complex power control needs, such as an array of web servers.

Figure 3. The PowerKey Schedule.

Controlling your system by events is quite easy. A PowerKey event consists of a trigger, which can be modified by qualifiers and actions. For example: At 9AM on Mon, Tue, Wed, Thu and Fri, not between Wed, Oct 1, 1997 and Tue, Oct 7, 1997: start up the computer. In other words, it's easy to set up your Mac to boot every weekday, but the week you're away in the Virgin Islands.

Figure 4. The Event Editor.

It is just as easy to create events that toggle any device's outlet, such as your modem or printer.

Event Triggers

The PowerKey has two general types of triggers: time triggers and system triggers. Time triggers are used to create automatic or repeating events while the system triggers actuate on certain types of computer or phone line activity.

Time triggers include: Once Only, Repeating, Days of Week, Day of Month.

System triggers include: "Power On" Key Pressed When Phone rings, Phone Tones Heard, When Hot Key Pressed, When system is Idle, When Power Returns, At Shut Down, When System Crashes, and When Timer Expires.

Figure 5. Triggers.

Event Qualifiers

Qualifiers refine how and when a trigger activates; all of a trigger's qualifiers must be true for the trigger to fire. For example, a When Phone Rings trigger could have qualifiers that allow it to work only after business hours and on weekends. Qualifiers vary depending on the type of trigger, but include: Time Range, Date Range, Days of Week, System Idle, How Started, and System Running.

Event Actions

The PowerKey has a very useful range of actions. In addition to the expected Switch Outlets, Start Up Computer, Shut Down Computer, and Restart, the PowerKey supports Execute Script, Execute QuicKey, Type a Keystroke, Wait, Open File, Quit Application, Mount SCSI Devices, Answer Phone, Add to Log and External Actions.

As an event is constructed, a natural language representation is crafted in the Event Editor Dialog, making the PowerKey one of the simplest-to-use scripting tools available.

Figure 6. Actions Types.

The Not-So-Basics

Remote Control

If that were all the PowerKey could do, it would be useful, but the PowerKey is designed to really shine as true remote control for your system's power. Listening in on the phone line, a PowerKey Pro can do any event based on the phone ringing any number of times, hearing certain touch-tones (DTMF) for security codes, or even distinctive-ring patterns. It was tremendously useful to teach my PowerKey to boot my Mac in any number of different startup configurations. Because an AppleScript (or QuicKey or Frontier script) can be part of an event, altering what software was active at reboot is relatively simple. With a phone call on a distinctive ring (short - long - short) and the entry of a code, my personal Mac can reboot for Apple Remote Access, fax reception, or a quickie web server with never a conflict over which application deserves the serial port. When it's been idle for 20 minutes, the System reboots to the preferred working configuration. As an added bonus, if the Mac was started up or rebooted over the phone, the monitor doesn't need to be powered up, so a nickel's worth of energy is saved.

The only minus with the telephone control is that the PowerKey doesn't understand ISDN lines or PBXes, but that is a small issue; having a dedicated line for computer control can be wise for a mission critical server.

Server Control

No Mac OS server should be without a PowerKey. (Apple, are you listening?) The Server Restart Option, a standard feature of the PK Pro 600 (and an option on the PK Pro 200) is a System Administrator's dream. When a server hangs, the When System Crashes trigger can be set up to restart and make life good again; when the utility company decides to take control of your server's life blood, the When Power Returns trigger can also reset whatever's needed. Many a dollar and much SysAdmin sleep can be saved by this automation. When combined with the secure telephone control of your server, a SysAdmin might actually be able to never touch the server physically except to replace hardware.

Mac-less operation

A Macintosh is needed to program the PowerKeyPro, but a useful feature is that a unit's scheduled events can be programmed at a Macintosh and then placed anywhere. Any Outlet switching action triggered on scheduling or telephone interaction is fully usable.

The User Timer

The PowerKey "pings" the Mac every 10 seconds to determine if the Mac is running; it if fails, the When System Crashes trigger can be fired. Conversely, a mission critical application that must be up and running 24/7, such as a webserver or database, can set the PowerKey User Timer to count down to a restart. As long as the User Timer is reset by the application, the PowerKey serves up power. If the app crashes and cannot reset the User Timer, the PowerKey can restart the Mac and a script or startup alias can have the mission critical application back without a System Administrator's action. Bravo, Sophisticated Circuits. Not only does every Mac OS server need a PowerKey, but every Mac-based info kiosk. (This feature can be implemented without AppleScript by sending an Apple event using Event Class 'PKPr' and Event ID 'Tick'.)

Custom Actions

If the actions the PowerKey Editor offers aren't quite enough, you can write your own External Action. External Actions are nothing more that HyperCard XCMDs. To make the External Action available to the PowerKey software, the compiled XCMD must be placed in a file of type/creator: Xtrn/PKPr and placed in the the PowerKey Folder in the the Preferences folder. After a restart, the new External Action will appear at the bottom of the Action Selector List.

Beeper

A simple PowerKey external, Beeper, plays your beep sound through the Mac's speaker. Beeper takes only one parameter, the number of times to beep the speaker. This code is available on the PowerKey installation disk.

#include<HyperXCmd.h>
#include <string.h>
#include <A4Stuff.h>

static void  xcmd_param_to_string 
              ( Handle param, char *str, short max_len );
static long  xcmd_param_to_num ( Handle param );

pascal void main ( XCmdPtr pb )
{
  // Setup base registers so we can access global variables.
  EnterCodeResource();

  pb->returnValue = nil;  // Setup return value field of pb

  if ( pb->paramCount == 0 )
    SysBeep( 0L );
  else
  {
    long    n, count;
    
    count = xcmd_param_to_num ( pb->params[0] );
    for ( n = 1; n <= count; n++ )
      SysBeep( 0L );
  }
    
  // Restore base registers before we return
  ExitCodeResource();    

}

static void xcmd_param_to_string 
              ( Handle param, char *str, short max_len )
{
  SignedByte  state;
  
  if ((param == 0L) || (str == 0L))
    return;

  state = HGetState (param);
  HLock (param);
  strncpy (str, *param, max_len);
  str [max_len] = '\0';
  
  HSetState (param, state);
  
  return;
}
    
static long xcmd_param_to_num ( Handle param )
{
  long    num = 0L;
  char    temp [256];
  char    *s;
  
  temp [0] = '\0';    
  xcmd_param_to_string (param, temp, 255);
  s = temp + strspn (temp, " ");
  CtoPstr (s);
  StringToNum ( (StringPtr)s, &num);
  
  return num;
}

AppleScript and The PowerKey Pro

Although able to run any OSA-compliant script, the PowerKey itself is scriptable, so any event can be scripted and executed. The Core Suite's Standard Events are supported (Get Data, Set Data, Quit Application) as well as PowerKey's own suite.

execute: execute a specified event
execute reference

Class application: An application program

Elements:
unit by numeric index, by name
Properties:
version string [r/o]
timer integer
log file specification [r/o]

Class unit: a PowerKey unit

Plural form:
units
Elements:
outlet by numeric index, by name
event by numeric index, by name
Properties:
name string
serial number integer [r/o]

Class outlet: an outlet

Plural form:
outlets
Properties:
name string
level integer

Class event: an event

Plural form:
events
Properties:
name string
serial number integer [r/o]
owner type class
enabled boolean

Scripting the PowerKey is simple, whether one uses AppleScript, Frontier, or QuicKeys. A simple (and rather useless) script to flash Outlet # 6 on is

on |pause|(length)
  local endTime
  set endTime to (current date) + length
  repeat while (current date) < endTime
  end repeat
end |pause|

on flicker(cycles, delay)
  repeat cycles times
    tell application "PowerKey Extension"
      set level of outlet 6 of unit 1 to 100 - (level of outlet 6 of unit 1)
    end tell
    |pause|(delay)
  end repeat
end flicker

Calling the above script could look like the following:

flicker(4, 1)

Third-Party Integration

The PowerKey has inspired some third party tools and integrates well with others. Acme Technologies offers PowerGate, a CGI (Common Gateway Interface) to the PK Pro, thereby allowing the PK Pro to be controlled securely from the web. Pacific Coast Software also offers a freeware ACGI, SiteMonitor, available at

http://www.pacific-coast.com/st_pages/Product_Dist/sitemcust.html.

Maxum Development's PageSentry is also an excellent fit with a PK Pro. PageSentry checks to see if a web server if up by requesting a page from the server; upon an error, it notifies the administrator. With the addition of a PowerKey Pro 600, PageSentry can merely activate a PowerKey Script to restart the web server. If WebSTAR (or whatever server you use) is set to launch at startup, the web server is back up and serving pages. Notice that this technique requires a Mac to handle the PowerKey, but the web server could be of any flavor: Mac, WinNT, Unix, or BeOS.

Real Uses

The PowerKey has some very special uses. Offering a level of one touch power control and scriptability is a very empowering aid and a blessing for the differently abled. (In fact, it's handy for those of us with more powered peripherals than we might really need.) A PowerKey Pro or three and some diligent scripting can allow the control of almost any electrical thing around someone with limited or nil mobility. Interesting uses can also include turning appliances on and off with your cordless phone, a script, hot key, or even speech recognition, scheduling a computer's startups and shutdown, as well as leaving the monitor off until needed.

Even though I know of no one currently using a PowerKey Pro to do this, having a group of routers controllable via a PowerKey Pro could allow routers to be power cycled so they can properly ping their seed router. The possibilities for creative System Administration abound.

One Year Later

It's a blizzardy New England Sunday afternoon and our snowed-in, yet still intrepid Mac SysAdmin is snug at home surfing the 'Net when the peaceful whine of the monitor's flyback transformer is shattered by a dreaded pager vibrating off the desk. The pager shows an notification from the Southeastern region's sales manager that the Florida sales force's main database is down during the weekend upload of sales figures. Ms. Manager wants it up right away no matter that Mr. SysAdmin's house can't see out of the 8 foot drift and a snowplow is considered a mythical beast.

He calls Ms. Manager and calmly assures her that the database will be up if there is power to the Mac and asks her to call right back if the system isn't up in 5 minutes.

Our System Administrator has little to worry about -- his PowerKey Pro 600 is ready.


When not whipping out articles, Christopher Hall, christopher@macconnect.com, is senior consultant for the chrysalis group/the Software Brewing co. of Memphis, TN and has been consulting since 1985. He is also selling a lovely home in Memphis which would cost $415,000 if it were in California. (3 BR, 2 Bath, pool, ethernet, cheap ISDN, $140K OBO.)

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »
Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links below... | Read more »
Marvel Future Fight celebrates nine year...
Announced alongside an advertising image I can only assume was aimed squarely at myself with the prominent Deadpool and Odin featured on it, Netmarble has revealed their celebrations for the 9th anniversary of Marvel Future Fight. The Countdown... | Read more »
HoYoFair 2024 prepares to showcase over...
To say Genshin Impact took the world by storm when it was released would be an understatement. However, I think the most surprising part of the launch was just how much further it went than gaming. There have been concerts, art shows, massive... | Read more »

Price Scanner via MacPrices.net

Apple Watch Ultra 2 now available at Apple fo...
Apple has, for the first time, begun offering Certified Refurbished Apple Watch Ultra 2 models in their online store for $679, or $120 off MSRP. Each Watch includes Apple’s standard one-year warranty... Read more
AT&T has the iPhone 14 on sale for only $...
AT&T has the 128GB Apple iPhone 14 available for only $5.99 per month for new and existing customers when you activate unlimited service and use AT&T’s 36 month installment plan. The fine... Read more
Amazon is offering a $100 discount on every M...
Amazon is offering a $100 instant discount on each configuration of Apple’s new 13″ M3 MacBook Air, in Midnight, this weekend. These are the lowest prices currently available for new 13″ M3 MacBook... Read more
You can save $300-$480 on a 14-inch M3 Pro/Ma...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
24-inch M1 iMacs available at Apple starting...
Apple has clearance M1 iMacs available in their Certified Refurbished store starting at $1049 and ranging up to $300 off original MSRP. Each iMac is in like-new condition and comes with Apple’s... Read more
Walmart continues to offer $699 13-inch M1 Ma...
Walmart continues to offer new Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBook for sale by... Read more
B&H has 13-inch M2 MacBook Airs with 16GB...
B&H Photo has 13″ MacBook Airs with M2 CPUs, 16GB of memory, and 256GB of storage in stock and on sale for $1099, $100 off Apple’s MSRP for this configuration. Free 1-2 day delivery is available... Read more
14-inch M3 MacBook Pro with 16GB of RAM avail...
Apple has the 14″ M3 MacBook Pro with 16GB of RAM and 1TB of storage, Certified Refurbished, available for $300 off MSRP. Each MacBook Pro features a new outer case, shipping is free, and an Apple 1-... Read more
Apple M2 Mac minis on sale for up to $150 off...
Amazon has Apple’s M2-powered Mac minis in stock and on sale for $100-$150 off MSRP, each including free delivery: – Mac mini M2/256GB SSD: $499, save $100 – Mac mini M2/512GB SSD: $699, save $100 –... Read more
Amazon is offering a $200 discount on 14-inch...
Amazon has 14-inch M3 MacBook Pros in stock and on sale for $200 off MSRP. Shipping is free. Note that Amazon’s stock tends to come and go: – 14″ M3 MacBook Pro (8GB RAM/512GB SSD): $1399.99, $200... Read more

Jobs Board

*Apple* Systems Administrator - JAMF - Syste...
Title: Apple Systems Administrator - JAMF ALTA is supporting a direct hire opportunity. This position is 100% Onsite for initial 3-6 months and then remote 1-2 Read more
Relationship Banker - *Apple* Valley Financ...
Relationship Banker - Apple Valley Financial Center APPLE VALLEY, Minnesota **Job Description:** At Bank of America, we are guided by a common purpose to help Read more
IN6728 Optometrist- *Apple* Valley, CA- Tar...
Date: Apr 9, 2024 Brand: Target Optical Location: Apple Valley, CA, US, 92308 **Requisition ID:** 824398 At Target Optical, we help people see and look great - and Read more
Medical Assistant - Orthopedics *Apple* Hil...
Medical Assistant - Orthopedics Apple Hill York Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Now Read more
*Apple* Systems Administrator - JAMF - Activ...
…**Public Trust/Other Required:** None **Job Family:** Systems Administration **Skills:** Apple Platforms,Computer Servers,Jamf Pro **Experience:** 3 + years of Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.