diff --git a/second-floor-lighting/stairwell/on-off.js b/second-floor-lighting/stairwell/on-off.js index c3f570f..e400fe2 100644 --- a/second-floor-lighting/stairwell/on-off.js +++ b/second-floor-lighting/stairwell/on-off.js @@ -19,7 +19,7 @@ let hallwayAction = {} if (payload === 'on') { if (goodnight === 'on') { hallwayAction = 'off' - } else if (nightMode === 'on' || peopleSleeping === true) { + } else if (nightMode === 'on' || (peopleSleeping === true && earlyNightMode === 'on')) { hallwayAction = 'on' hallwayScene = 'Nightlight' } else if (earlyNightMode === 'on') { @@ -46,7 +46,7 @@ if (payload === 'on') { node.status({fill:'red',shape:'ring',text:'Too bright'}) } } else if (payload === 'off') { - if (stairwellLights === 'on') { + if (stairwellLights === 'on' || hallwayLights === 'on') { msg.duration = newDuration node.status({fill:"green",shape:"dot",text:parseInt(duration) + ' minutes'}) node.send([null,msg,null,null])