[ALUG] Wanted - simple way to check mains power is available

Chris G cl at isbd.net
Wed Jan 26 15:41:50 GMT 2011

I'm looking for the simplest possible way for a script (or any sort of
program, can be C, Python, whatever you like within reason) to check
whether mains power is on.

The computer which is going to check this is running off batteries so
will still be running (I'm not quite that stupid!).

The easiest way I can think of at the moment is to have some sort of
hardware with a presence on the LAN powered by mains so that one can ping
it to check that mains power is there.  However the 'simplest' device I
have at the moment is an old router which seems rather overkill for such
a simple requirement.

Can anyone think of any better way of doing this for which I am likely
to have the hardware available or which will cost very little?  I'm
quite happy to build simple bits of electronics.  The computer running
the check is an old eeePc so has only USB and ehternet connections as
far as I remember.

Chris Green

More information about the main mailing list