Taking Advantage of the Open Platform

Some of the interesting aspects that can be controlled via SSH are outlined in this blog post by a UK reseller. The examples seem to be based on a older version of the firmware, and, other than the relay control, deal more with cosmetic aspects such as the LED flashing rate and colour. In the latest version (2.0.7) of the firmware, we also have tags for the outlets. The power consumption values are also updated on a more frequent basis (once per second for each outlet, compared to one outlet each second in the earlier versions). This allows for development of a real-time power consumption analyzer using the mPower units.

While reviewing the UFO Power Center, I had talked about a custom Perl script that was developed for real-time power measurement. I have been making improvements to the script (to be leaner on resources, and adding more features) over the last year. It has now been pushed out to the open source community. A similar script has been developed for the mPower units too. The source is available here. Readers should feel free to check out the scripts, add / suggest features and report / fix bugs. In our limited testing, it has worked fine on Windows 7 / Cygwin, but other platforms haven't been tested.

One feature that I would like to add to the script above is auto-discovery of mPower units in the network. Currently, the script expects the IP of the mPower unit as well as the login credentials to be supplied as command line arguments. Another interesting feature would be a configurable polling rate. The script currently polls for the power consumption values once every second.

It should be noted that the above script works only with mPower units running firmware version 2.0.7. Later versions should also work, unless Ubiquiti does away with some of the used features. Version 2.0.7 added labels for each outlet, and these are stored in /var/etc/persistent/cfg/config_file. Relay status and active power for outlet X are available in /proc/power/relayX and /proc/power/active_pwrX. relayX is writable, with a write of 1 to turn the outlet on, and 0 to turn it off. active_pwrX (as well as v_rmsX, i_rmsX and pfX under /proc/power) report values accurate up to 9 decimal places.

One of the downside of the mPower is the fact that any power consumption below 1W is reported as 0. Unfortunately, this is the intent of the design. Ubiquiti indicates that they found too many issues with AC power systems (noise, inductive loads etc.) to provide enough accuracy at power levels below 1W. Pulling down sub-1W power values to 0 also simplifies rules (particularly, to ensure that rules based on non-zero power don't trigger when nothing is connected and there is leakage current).

Inside the mPower Concluding Remarks
Comments Locked

61 Comments

View All Comments

  • easp - Thursday, November 21, 2013 - link

    I'm intrigued by it for controlling some relatively dumb devices that draw a lot of power, like space heaters, a dehumidifier and a floor-standing AC unit. With this, a cheap wireless weather and temp/humidity system I've already hacked, and a few scripts, I could easily start controlling things based on things like presence, differences between indoor and outdoor temps, etc.

    That obviously isn't something your average person is going to do, but it isn't hard to imagine that sort of thing becoming turn-key.
  • bznotins - Thursday, November 21, 2013 - link

    When my home server (which I use as my personal cloud) hard-locks when I'm on the road, it would be nice to power-cycle it remotely. This will let me do that, so I ordered it.

    Sample size of one, but there are people that can use this kind of device.
  • jason32 - Friday, November 22, 2013 - link

    Why is your server crashing like that and often enough for you to consider getting the mPower? You should probably fix that first before looking into the last resort power cycling solution.
  • bznotins - Wednesday, November 27, 2013 - link

    It only does it about once a month. Pretty hard to diagnose.

    But that once a month always seems to be when I'm on the road and can't power-cycle it in-person?

    Is this power strip a panacea? No. But my point is that there is a use for it.
  • azazel1024 - Thursday, November 21, 2013 - link

    I feel like an important piece of information is missing. How much does the mFi mPower ITSELF user in terms of power. It sounds interesting and I certainly have tons of ideas on how I could use it (or other could). However, a large part of that would be power savings.

    If the thing burns 5w of power though...that just might tip it from possibly saving power in some usage scenarios to burning more power than it saves.
  • ganeshts - Sunday, November 24, 2013 - link

    I will update the article shortly.. It consumes slightly less than 1W when idle.
  • samsp99 - Thursday, November 21, 2013 - link

    Last weekend I found a similar product from quirky at home depot. In conjunction with GE they have a line of wifi connected products, including a sensor, egg monitor, guage dashboard, and a power strip with two outlets that can be remotely switched from an iOS or Android device.
    The cool thing is to program them you "blink" them by holding a smartphone screen against a sensor that detects a flashing sequence on the screen. This is based on tech from Electric Imp which developed the chipset and has a developer kit and SDK for building your own devices.

    I bought the power strip for fun, but with an eye to controlling the xmas lights, so I can have them on a timer, but also switch on and off on demand.
  • Kurge - Thursday, November 21, 2013 - link

    Might be moderately interesting if it support Vera. Would be even more interesting if it was a standard power outlet that fits in a normal box.

    As it stands - meh.
  • drizzo4shizzo - Thursday, November 21, 2013 - link

    Don't plug your wifi router into it...
  • nekoken - Thursday, November 21, 2013 - link

    According to your screenshot this device has 32MB of ram, not 16.

    I may have to buy one or more of these. This looks like a good way to kick my children off of specific electronic devices remotely. ssh in and BAM!

Log in

Don't have an account? Sign up now