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
|
const coolingActive = states['input_boolean.emma_bedroom_cooling_on'].state
|
||||||
node.log("Emma Bedroom Climate: Constants Set")
|
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
|
// Helper function to convert a string to title case
|
||||||
|
|
||||||
function convertToTitleCase(str) {
|
function convertToTitleCase(str) {
|
||||||
@ -203,7 +207,7 @@ let sendHvac = {
|
|||||||
"payload": {
|
"payload": {
|
||||||
"action": "climate.set_hvac_mode",
|
"action": "climate.set_hvac_mode",
|
||||||
"target": {
|
"target": {
|
||||||
"entity_id": ["climate.emma_bedroom_aircon"]
|
"entity_id": emmaBedroomAircon
|
||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"hvac_mode": setHvac
|
"hvac_mode": setHvac
|
||||||
@ -215,7 +219,7 @@ let sendTemp = {
|
|||||||
"payload": {
|
"payload": {
|
||||||
"action": "climate.set_temperature",
|
"action": "climate.set_temperature",
|
||||||
"target": {
|
"target": {
|
||||||
"entity_id": ["climate.emma_bedroom_aircon"]
|
"entity_id": emmaBedroomAircon
|
||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"temperature": setTemp
|
"temperature": setTemp
|
||||||
@ -227,7 +231,7 @@ let sendEco = {
|
|||||||
"payload": {
|
"payload": {
|
||||||
"action": "climate.set_preset_mode",
|
"action": "climate.set_preset_mode",
|
||||||
"target": {
|
"target": {
|
||||||
"entity_id": ["climate.emma_bedroom_aircon"]
|
"entity_id": emmaBedroomAircon
|
||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"preset_mode": setEco
|
"preset_mode": setEco
|
||||||
@ -239,7 +243,7 @@ let sendAcFan = {
|
|||||||
"payload": {
|
"payload": {
|
||||||
"action": "climate.set_fan_mode",
|
"action": "climate.set_fan_mode",
|
||||||
"target": {
|
"target": {
|
||||||
"entity_id": ["climate.emma_bedroom_aircon"]
|
"entity_id": emmaBedroomAircon
|
||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"fan_mode": "auto"
|
"fan_mode": "auto"
|
||||||
|
Reference in New Issue
Block a user