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 }