/** * Determines the brightness of the given bulb. * * @param deviceNumber The bulb number the bridge has filed the bulb under. * @return The brightness as a value from 0 - 255 */ public int getBrightness(int deviceNumber) { if (settingsData == null) { logger.error("Hue bridge settings not initialized correctly."); return 0; } return (Integer) settingsData.node("lights").node(Integer.toString(deviceNumber)).node("state").value("bri"); }
/** * Determines whether the given bulb is turned on. * * @param deviceNumber The bulb number the bridge has filed the bulb under. * @return true if the bulb is turned on, false otherwise. */ public boolean isBulbOn(int deviceNumber) { if (settingsData == null) { logger.error("Hue bridge settings not initialized correctly."); return false; } return (Boolean) settingsData.node("lights").node(Integer.toString(deviceNumber)).node("state").value("on"); }
/** * Determines the color temperature of the given bulb. * * @param deviceNumber The bulb number the bridge has filed the bulb under. * @return The color temperature as a value from 154 - 500 */ public int getColorTemperature(int deviceNumber) { if (settingsData == null) { logger.error("Hue bridge settings not initialized correctly."); return 154; } Object ct = settingsData.node("lights").node(Integer.toString(deviceNumber)).node("state").value("ct"); if (ct instanceof Integer) { return (Integer) ct; } else { return 154; } }
/** * Determines the saturation of the given bulb. * * @param deviceNumber The bulb number the bridge has filed the bulb under. * @return The saturation as a value from 0 - 254 */ public int getSaturation(int deviceNumber) { if (settingsData == null) { logger.error("Hue bridge settings not initialized correctly."); return 0; } Object sat = settingsData.node("lights").node(Integer.toString(deviceNumber)).node("state").value("sat"); if (sat instanceof Integer) { return (Integer) sat; } else { return 0; } }