Changes to test.js and a bugfix for index.js

Now correctly emits state when the socket is toggled elsewhere (e.g. the
app or physical button). test.js also tweaked. If autoToggle is false,
the relay won't toggle every 2 seconds