Initial commit
This commit is contained in:
13
front-porch/delay.js
Normal file
13
front-porch/delay.js
Normal file
@ -0,0 +1,13 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
const delay = states['input_number.front_porch_motion_off_delay'].state
|
||||
const duration = delay * 60
|
||||
const lights = states['light.front_porch_light'].state
|
||||
|
||||
msg.duration = duration
|
||||
|
||||
if (lights === 'on') {
|
||||
node.status({fill:"green",shape:"dot",text: parseInt(delay) + " minutes"})
|
||||
node.send(msg)
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Light Off"})
|
||||
}
|
Reference in New Issue
Block a user