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

  • bznotins - Tuesday, December 10, 2013 - link

    So I ordered this from Amazon and have been generally impressed. A few problems, though, one which is quite ironic.

    The ironic one first. One of the reasons I bought this tool to help measure my power usage and ultimately reduce it. My home server is basically a Win8.1 box with TeamViewer access. It remains on 24/7 (except for the once a month when it hard locks and I have to power-cycle it, which is the other reason for this mFi power bar). Anyways, my home server generally uses 30W at idle. The simple act of installing the Win8 mFi home server software pushes the CPU utilization up so that it's no longer in low-power idle and my server consumes 60W (as measured by the same power bar, heh). So just tracking my power using the server doubles the consumption of my home server.

    Thankfully the mFi server software can be shut down so that it doesn't run 24/7 and the power bar can still be accessed via its IP. And it works great in that case. Easy to turn each outlet off if necessary both from LAN and WAN (using port forwarding on my router).

    My other problem with the unit is that it is connected to my home network AND broadcasting its unsecured adhoc network at the same time. There is no apparent way to disable the latter once the former is running. I thought that it would be automatic. In fact, I didn't think it was possible for the device to be connected to my home network and broadcasting an adhoc network simultaneously, but it is. I plan to mess with this further as the device isn't terribly friendly to novices like me.

    Overall I'm happy because it does what I need it to, but there are still some issues.

Log in

Don't have an account? Sign up now