17 lines
613 B
JavaScript
17 lines
613 B
JavaScript
const states = global.get('homeassistant.homeAssistant.states')
|
|
const enabled = states['input_boolean.emma_alarm_clock'].state
|
|
const sleeping = states['input_boolean.emma_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
|
|
} |