From c7471fd45b9c05fd2600e8e296744c769ca852dc Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Sat, 29 Mar 2025 01:10:04 -0400 Subject: [PATCH] Turn aircon entity ID into a constant --- climate/emma-bedroom/processing.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/climate/emma-bedroom/processing.js b/climate/emma-bedroom/processing.js index eb88c80..9ffdc80 100644 --- a/climate/emma-bedroom/processing.js +++ b/climate/emma-bedroom/processing.js @@ -20,6 +20,10 @@ const meltdown = states['input_boolean.meltdown_protocol'].state const coolingActive = states['input_boolean.emma_bedroom_cooling_on'].state node.log("Emma Bedroom Climate: Constants Set") +// Define some entity IDs + +const emmaBedroomAircon = "climate.emma_bedroom_aircon" + // Helper function to convert a string to title case function convertToTitleCase(str) { @@ -203,7 +207,7 @@ let sendHvac = { "payload": { "action": "climate.set_hvac_mode", "target": { - "entity_id": ["climate.emma_bedroom_aircon"] + "entity_id": emmaBedroomAircon }, "data": { "hvac_mode": setHvac @@ -215,7 +219,7 @@ let sendTemp = { "payload": { "action": "climate.set_temperature", "target": { - "entity_id": ["climate.emma_bedroom_aircon"] + "entity_id": emmaBedroomAircon }, "data": { "temperature": setTemp @@ -227,7 +231,7 @@ let sendEco = { "payload": { "action": "climate.set_preset_mode", "target": { - "entity_id": ["climate.emma_bedroom_aircon"] + "entity_id": emmaBedroomAircon }, "data": { "preset_mode": setEco @@ -239,7 +243,7 @@ let sendAcFan = { "payload": { "action": "climate.set_fan_mode", "target": { - "entity_id": ["climate.emma_bedroom_aircon"] + "entity_id": emmaBedroomAircon }, "data": { "fan_mode": "auto"