Refactors register/heartbeat sequence for devices.
Refactors register/heartbeat sequence for devices.

This is in part to fix the registration of the data and message listeners
for sensors and actuators, respectively.

hlapp/ninja-mqtt