@SuppressWarnings("unchecked")
    public static void setHSB(final int hue, final int saturation, final int brightness, int light_ID) {

        // Prepare the parameters for the request
        JSONObject parameters = new JSONObject();
        //parameters.put("colormode", "hs");
        parameters.put("hue", hue);
        parameters.put("sat", saturation);
        parameters.put("bri", brightness);
        parameters.put("transitiontime", Config.TRANSITION_DURATION);
        final String parameterString = parameters.toJSONString();

        System.out.println(parameterString);

        if (Config.LIVE) {
            HttpURLConnection connection = null;
            DataOutputStream writer = null;
            BufferedReader reader = null;
            try {
                // Prepare the connection
                final URL url = new URL("http://" + Config.IP + "/api/" + Config.USERNAME
                        + "/lights/" + light_ID + "/state");
                connection = (HttpURLConnection) url.openConnection();

                connection.setDoOutput(true);
                connection.setDoInput(true);
                connection.setInstanceFollowRedirects(false);
                connection.setRequestMethod("PUT");
                connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                connection.setRequestProperty("charset", "utf-8");
                connection.setRequestProperty("Content-Length",
                        "" + Integer.toString(parameterString.getBytes().length));
                connection.setUseCaches(false);

                // Send the parameters
                writer = new DataOutputStream(connection.getOutputStream());
                writer.writeBytes(parameterString);
                writer.flush();

                // Print the response
                reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                while ((inputLine = reader.readLine()) != null) {
                    System.out.println(inputLine);
                }
                reader.close();

            } catch (final IOException ex) {
                ex.printStackTrace();

            } finally {
                // Close all connections and buffers
                if (connection != null) {
                    connection.disconnect();
                }
                if (writer != null) {
                    try {
                        writer.close();
                    } catch (IOException ex) {}
                }
                if (reader != null) {
                    try {
                        reader.close();
                    } catch (IOException ex) {
                        ex.printStackTrace();
                    }
                }
            }
        }
    }