Fix timer not being canceled when motion is detected again
This commit is contained in:
@ -11,10 +11,11 @@ if (sleeping === 'off') {
|
||||
if (payload === 'on') {
|
||||
if (lux <= threshold && lights === 'off') {
|
||||
node.status({fill:'green',shape:'dot',text:'Turning lights on'})
|
||||
node.send([msg,null])
|
||||
node.send([msg,msg,null])
|
||||
} else {
|
||||
if (lights === 'off') {
|
||||
if (lights === 'on') {
|
||||
node.status({fill:'red',shape:'ring',text:'Lights already on'})
|
||||
node.send([null,msg,null])
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Too bright'})
|
||||
}
|
||||
@ -23,7 +24,7 @@ if (sleeping === 'off') {
|
||||
if (lights === 'on') {
|
||||
msg.duration = newDuration
|
||||
node.status({fill:"green",shape:"dot",text:parseInt(duration) + ' minutes'})
|
||||
node.send([null,msg])
|
||||
node.send([null,null,msg])
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Lights already off"})
|
||||
}
|
||||
|
@ -11,10 +11,11 @@ if (sleeping === 'off') {
|
||||
if (payload === 'on') {
|
||||
if (lux <= threshold && lights === 'off') {
|
||||
node.status({fill:'green',shape:'dot',text:'Turning lights on'})
|
||||
node.send([msg,null])
|
||||
node.send([msg,msg,null])
|
||||
} else {
|
||||
if (lights === 'off') {
|
||||
if (lights === 'on') {
|
||||
node.status({fill:'red',shape:'ring',text:'Lights already on'})
|
||||
node.send([null,msg,null])
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Too bright'})
|
||||
}
|
||||
@ -23,7 +24,7 @@ if (sleeping === 'off') {
|
||||
if (lights === 'on') {
|
||||
msg.duration = newDuration
|
||||
node.status({fill:"green",shape:"dot",text:parseInt(duration) + ' minutes'})
|
||||
node.send([null,msg])
|
||||
node.send([null,null,msg])
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Lights already off"})
|
||||
}
|
||||
|
@ -14,10 +14,11 @@ if (peopleSleeping === false && nightMode === 'off') {
|
||||
if (payload === 'on') {
|
||||
if (lux <= threshold && lights === 'off') {
|
||||
node.status({fill:'green',shape:'dot',text:'Turning lights on'})
|
||||
node.send([msg,null])
|
||||
node.send([msg,msg,null])
|
||||
} else {
|
||||
if (lights === 'off') {
|
||||
if (lights === 'on') {
|
||||
node.status({fill:'red',shape:'ring',text:'Lights already on'})
|
||||
node.send([null,msg,null])
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Too bright'})
|
||||
}
|
||||
@ -26,7 +27,7 @@ if (peopleSleeping === false && nightMode === 'off') {
|
||||
if (lights === 'on') {
|
||||
msg.duration = newDuration
|
||||
node.status({fill:"green",shape:"dot",text:parseInt(duration) + ' minutes'})
|
||||
node.send([null,msg])
|
||||
node.send([null,null,msg])
|
||||
} else {
|
||||
node.status({fill:"red",shape:"ring",text:"Lights already off"})
|
||||
}
|
||||
|
Reference in New Issue
Block a user