The functionality was ported from https://github.com/jangxx/node-magichome to Java 11+
Control MagicHue lights
Controller: Turn the lights on and off. Set Colors. Store a name to use with a controller
Discover: Discover Magic Home lights on the network
You can download the JAR library from the releases page or here. Then you can import it to your Java 11+ Project.
File --> Project Structure --> Libraries --> Press the + button --> Select JAR File --> OK
Controller[] controllers = Discover.Scan(); // Scan for available controllers on the network
String ip = controllers[0].getIP(); // Get controller's IP
controllers[0].setColor(255, 0, 0); // Change the color of the controller to red
controllers[0].setWarmWhite(255); // Change controller to warm white (if available)
controllers[0].setColdWhite(255); // Change controller to cold white (if available)
controllers[0].setPower(false); // Turn off controller
-
-
- Get the IP of the controller
- Params: -
- Return: String
-
- Get the ID of the controller
- Params: -
- Return: String
-
- Get the Model of the controller
- Params: -
- Return: String
-
- Get the Name of the controller
- Params: -
- Return: String
-
- Set the Name of the controller and store it
- Params: name: String
- Return: -
-
- Turn on and off the controller
- Params: on: Boolean
- Return: TRUE successful, FALSE if failed
-
- Set the RGB color of the controller
- Params: red: Integer(0-255), green: Integer(0-255), blue: Integer(0-255)
- Return: TRUE successful, FALSE if failed
-
- Set the Warm White value of the controller (if available)
- Params: ww: Integer(0-255)
- Return: TRUE successful, FALSE if failed
-
- Set the Cold White value of the controller (if available)
- Params: cw: Integer(0-255)
- Return: TRUE successful, FALSE if failed
-
- Query the properties of the controller
- Params: -
- Return: HashMap(key: String, value: Object)
type: Integer on: Boolean mode: String (color / ia_pattern / pattern / custom / special) pattern: String (One of the hard-coded pattern's name) speed: Integer colors.red: Integer colors.green: Integer colors.blue: Integer warm_white: Integer cold_white: Integer
-
- Check if the controller color values matches the stored values
- Params: -
- Return: TRUE everything matches, FALSE something did not match
-
-
-
- Search for available controllers
- Params: -
- Return: Array of Controller class
-