|
|
@ -7,12 +7,11 @@ const { lights } = require("./config.js");
|
|
|
|
async function send_color(light_data, color, max_brightness, debug) {
|
|
|
|
async function send_color(light_data, color, max_brightness, debug) {
|
|
|
|
const brightness = (color[0] + color[1] + color[2]) / 3 / 255;
|
|
|
|
const brightness = (color[0] + color[1] + color[2]) / 3 / 255;
|
|
|
|
if (debug) {
|
|
|
|
if (debug) {
|
|
|
|
console.log(
|
|
|
|
console.log({
|
|
|
|
"sum",
|
|
|
|
light_data,
|
|
|
|
color[0] + color[1] + color[2],
|
|
|
|
sum: color[0] + color[1] + color[2],
|
|
|
|
"brightness",
|
|
|
|
brightness,
|
|
|
|
brightness
|
|
|
|
});
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let body = { entity_id: `light.${light_data.id}`, transition: 0.18 };
|
|
|
|
let body = { entity_id: `light.${light_data.id}`, transition: 0.18 };
|
|
|
|
if (debug) {
|
|
|
|
if (debug) {
|
|
|
|