Replace all "var" usage with const and/or let
This commit is contained in:
27
climate/master-bedroom/shower-on.js
Normal file
27
climate/master-bedroom/shower-on.js
Normal file
@ -0,0 +1,27 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
const ac = states['input_boolean.master_bedroom_aircon_installed'].state
|
||||
const temp = global.get('tempStr')
|
||||
const threshold = states['input_number.master_bedroom_aircon_run_threshold'].state
|
||||
const nightTemp = states['input_number.master_bedroom_night_temp'].state
|
||||
const bedTemp = states['input_number.master_bedroom_bedtime_temp'].state
|
||||
const sleeping = states['input_boolean.master_bedroom_sleeping'].state
|
||||
|
||||
if (ac === 'on') {
|
||||
if (temp >= threshold) {
|
||||
if (sleeping === 'on') {
|
||||
msg.set = bedTemp
|
||||
node.status({fill:"green",shape:"dot",text:"Shower Mode On: " + bedTemp})
|
||||
return msg
|
||||
} else {
|
||||
msg.set = nightTemp
|
||||
node.status({fill:"green",shape:"dot",text:"Shower Mode On: " + nightTemp})
|
||||
return msg
|
||||
}
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Too Cold"})
|
||||
return null
|
||||
}
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"A/C Not Installed"})
|
||||
return null
|
||||
}
|
Reference in New Issue
Block a user