Replace all "var" usage with const and/or let
This commit is contained in:
17
alarm-clocks/emma-bedroom/processing-end.js
Normal file
17
alarm-clocks/emma-bedroom/processing-end.js
Normal file
@ -0,0 +1,17 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user