-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmilight_ajax.php
42 lines (38 loc) · 1.03 KB
/
milight_ajax.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
require("includes/incl_milight.php");
$result = "ERR";
$milight = new Milight($_GET['mlip'], (integer)$_GET['mlport']);
$milight->setDelay(0);
$milight->setRepeats(1);
$milight->setRgbwActiveGroup((integer)$_GET['mlgroup']);
if (isset($_GET['off'])) {
$milight->rgbwSendOffToGroup($_GET['off']);
$result = "#OK#";
}
if (isset($_GET['on'])) {
$milight->setActiveGroupSend(1);
$milight->rgbwSendOnToGroup($_GET['on']);
$milight->setActiveGroupSend(0);
$result = "#OK#";
}
if (isset($_GET['white'])) {
$milight->rgbwSetGroupToWhite($_GET['white']);
$result = "#OK#";
}
if (isset($_GET['night'])) {
$milight->rgbwSetGroupToNightMode($_GET['night']);
$result = "#OK#";
}
if (isset($_GET['hue'])) {
//$result = $_GET['mlip'].":".$_GET['mlport']." ".$_GET['mlgroup'].":".$_GET['hue'];
$milight->rgbwSetColorHsv([$_GET['hue'], 1, 0.5]);
$result = "#OK#";
}
if (isset($_GET['brightness'])) {
//echo $_GET['hue'];
$milight->rgbwBrightnessPercent(min(100,$_GET['brightness']));
$result = "#OK#";
}
unset($milight);
echo $result;
?>