Added a debug option and support for brightness control

Added a debug option, set debug = true; inside energy.js
Added support for brightness control