Homeplugs are awesome! I use them for some of the networking at home where I need better throughput or latency than WiFi. They work well for this but there’s a downside. Inevitably they seem to get themselves all mixed up which leads to increased latency and eventually a total lack of service. You can fix this pretty easily if you go all the way around your home, unplug them all and then plug them all back in.
Lets be honest though, that’s a bit of a pain. So I’ve written a perl script that enumerates all the plugs on the local network and reboots them all remotely. It looks like this:
#!/usr/bin/perl
use v5.10;
use warnings;
use strict;
use Readonly;
use IPC::Cmd qw/ run /;
# Get the MACs of all other homeplugs
run(command => "echo A038 | faifa -m",
buffer => \my $out,
# For some reason it takes about this long to get the data
timeout => 3);
Readonly my @MACS => $out =~ /\n((?:\w{2}:){5}\w{2})/g;
for my $mac (@MACS) {
# Reboot other homeplugs one at a time
run(command => "echo A01C | faifa -m -a $mac",
timeout => 1);
}
# Then reboot this one
run(command => "echo A01C | faifa -m",
timeout => 1);
It needs to shell out to faifa so you’ll need to make sure that installed. On my box it installed from the ubuntu repos just fine. You can download the script here.
Comments