Level Monitor

Extending the system, interesting uses and API twiddling.
Post Reply
Posts: 34
Joined: Fri Nov 25, 2011 11:27 pm
Location: Oxfordshire

Level Monitor

Post by phil4 » Tue Dec 06, 2011 8:06 am

I thought I'd share another little app I coded that find useful.

This is a very quick and simple application to turn the smartplugs on or off if their power usage drops below a certain level for a period of time. Perhaps useful if like me you want to turn a device off after a period of non-usage (eg . a computer or TV).

No timer needed for this one, just set it going and wait.


If when it runs you need to pass it four parameters:
on/off ... what you want to do to the smartplug... I can't think why you'd want on, but its there incase.
deviceID... see below
counter... how many hits before it turns the plug on/off.
threshold... if the power level drops below this when checked it knocks one off the counter.
delay... how long (in seconds) between checks.

LevelMonitor.exe off 00-0D-6E-00-00-17-1E-75 15 75 10

This will turn the plug off if 15 times in a row it's below 75W, it checks every 10 seconds.

I use 10seconds as the period for checking. I found that longer produced strange problems on Windows Server 2003, but no issues in Windows Vista. YMMV.

If the power level is above, it resets the counter. If the power level is 0W, it assumes the plug is already off, and resets the counter. If the counter reaches 0 the action is performed (on/off), and then the counter reset.

You will need the .net framework 3.5 installed.

You'll need to edit the SmartPlugTimer.exe.config file, in it put your Alertme username and password.

In order to find the unique IDs of your smartplugs you'll need this little program:


run the program, enter your alertme username and password in the two boxes and click Go!

You'll then get a long list of all the devices hooked up to your hub. The devices are listed in a slightly strange way.... your name, device id, device type...

So we're looking for any "Power Controller" devices, the ID is the thing immediately preceding it... so if you have some lines like this:

Contact Sensor,TV
PowerController,Living Room 2
Motion Sensor,Dining Room

In this case the SmartPlug IDs are:

Enter these into the correct places in your run command as required.

Apologies for it not being blindingly simple to use, happy to give a few pointers if needed, but would rather not act as your home PC tech support

All warranties express or implied are null and void. The product is suitable for nothing, and is not fit for any purpose. Use at your own risk. No refunds.

User avatar
Site Admin
Posts: 223
Joined: Mon Nov 21, 2011 4:56 pm
Location: Manchester, UK

Re: Level Monitor

Post by roobarb! » Tue Dec 06, 2011 2:24 pm

Brilliant stuff - thanks for posting! Might have a play with this later. :)
Alerty - you could control your AlertMe system with my third-party app for iPhone and iPod Touch. Used to be available on iTunes!

Post Reply