Moved hue-lights JS code to file. Added console- and error redirection.