Files
HA-NerdFlows-Functions/alarm-clocks/kallen-bedroom/processing-end.js

17 lines
617 B
JavaScript

const states = global.get('homeassistant.homeAssistant.states')
const enabled = states['input_boolean.kallen_alarm_clock'].state
const sleeping = states['input_boolean.kallen_sleeping'].state
if (enabled === 'on' && sleeping === 'off') {
node.status({fill:"green",shape:"dot",text:"Proceed"})
return msg
} else if (enabled === 'off') {
node.status({fill:"red",shape:"ring",text:"Disabled"})
return null
} else if (sleeping === 'on') {
node.status({fill:"red",shape:"ring",text:"Sleeping"})
return null
} else {
node.status({fill:"red",shape:"ring",text:"Unknown Error"})
return null
}