|
|
@ -14,9 +14,6 @@ async function send_color(light_data, color, max_brightness, debug) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let body = { entity_id: `light.${light_data.id}`, transition: 0.18 };
|
|
|
|
let body = { entity_id: `light.${light_data.id}`, transition: 0.18 };
|
|
|
|
if (debug) {
|
|
|
|
|
|
|
|
console.log("sending", body);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (light_data.type == "rgb") {
|
|
|
|
if (light_data.type == "rgb") {
|
|
|
|
body.rgb_color = color;
|
|
|
|
body.rgb_color = color;
|
|
|
@ -30,6 +27,10 @@ async function send_color(light_data, color, max_brightness, debug) {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (debug) {
|
|
|
|
|
|
|
|
console.log("sending", body);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return fetch(`${HA_URL}/api/services/light/turn_on`, {
|
|
|
|
return fetch(`${HA_URL}/api/services/light/turn_on`, {
|
|
|
|
method: "POST",
|
|
|
|
method: "POST",
|
|
|
|
headers: {
|
|
|
|
headers: {
|
|
|
|