Lots of bug fixes

Everything finally seems to stay in sync - the relays, the arduino
device-type and the virtual switch device-types.