Turn aircon entity ID into a constant
This commit is contained in:
@ -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"
|
||||
|
Reference in New Issue
Block a user