From ce5083d7b75558cd1a90890892545719b43abc5f Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Sat, 30 Dec 2023 14:20:44 +0100 Subject: [PATCH] Better debug --- light-loop.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/light-loop.js b/light-loop.js index 18ec456..159c6d2 100644 --- a/light-loop.js +++ b/light-loop.js @@ -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 }; - if (debug) { - console.log("sending", body); - } if (light_data.type == "rgb") { 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`, { method: "POST", headers: {