English

For members and potential guests of the hackersspace who'd like to know if the space is opened or closed before they pop by, we needed a simple method of indicating this. Preferably on the main site http://hack42.nl/, but also on twitter and in our irc channel. The simple method chosen was a SpaceStateSwitch, based on a mad-scientist-lab worthy switch, as depicted above. This is the story of the rest of the technical implementation.

Hardware

The SpaceStateSwitch is a DPST switch connected to the second ethernet port of a Soekris 4511 accesspoint. Closing the switch connects tx+/rx+ and tx-/rx-, causing eth1 to detect link up.

Software

The Access Point runs linux. Using cron the statecheck script is executed each minute; it uses ethtool to check for eth1 link up.

statecheck.sh script in pseudocode:

IF connection_state_eth1 eq connected AND laststate eq closed;
curl http://user@pass:host/spacestate/setstate.php?state=open
IF curl_success; set laststate open
IF connection_state_eth1 eq disconnected AND laststate eq open;
curl http://user@pass:host/spacestate/setstate.php?state=closed
IF curl_success; set laststate closed

Tweets

Twittering the status change to @hack42 is done using setstate.php on the external webserver. It also modifies http://hack42.nl/spacestate/index.html , a very bare page which can be quickly and easily accessed via almost any phone with internet capabilities.

Interface to IRC

irc://irc.hack42.nl/#hack42 runs a gozerbot with rss-feed plugin.
One of the feeds is http;//twitter.com/hack42, which is checked every minute and echoed into the channel