diff --git a/first-floor-lighting/downstairs-bathroom/downstairs-bathroom.js b/first-floor-lighting/downstairs-bathroom/downstairs-bathroom.js index 6aa09c4..cddce53 100644 --- a/first-floor-lighting/downstairs-bathroom/downstairs-bathroom.js +++ b/first-floor-lighting/downstairs-bathroom/downstairs-bathroom.js @@ -1,8 +1,8 @@ const states = global.get('homeassistant.homeAssistant.states') const lights = states['light.downstairs_bathroom_lights'].state const duration = states['input_number.downstairs_bathroom_lights_off_delay'].state -const lux = states['sensor.downstairs_bathroom_illuminance'].state -const threshold = states['input_number.downstairs_bathroom_lux_threshold'].state +const lux = parseInt(states['sensor.downstairs_bathroom_illuminance'].state) +const threshold = parseInt(states['input_number.downstairs_bathroom_lux_threshold'].state) const payload = msg.payload const newDuration = duration * 60 diff --git a/first-floor-lighting/living-room/processing.js b/first-floor-lighting/living-room/processing.js index 3b9d960..972c78e 100644 --- a/first-floor-lighting/living-room/processing.js +++ b/first-floor-lighting/living-room/processing.js @@ -23,7 +23,7 @@ if (topic === 'motion' && block === false) { node.send([msg,null,null]) } else if (payload === 'off') { msg.duration = newDuration - node.status({fill:'red',shape:'ring',text:'Motion Off'}) + node.status({fill:'red',shape:'ring',text:parseInt(duration) + ' minutes'}) node.send([null,msg,null]) } } else if (topic === 'timer') { diff --git a/second-floor-lighting/emma-bedroom/emma-bedroom.js b/second-floor-lighting/emma-bedroom/emma-bedroom.js index c20eadb..c5453e8 100644 --- a/second-floor-lighting/emma-bedroom/emma-bedroom.js +++ b/second-floor-lighting/emma-bedroom/emma-bedroom.js @@ -1,8 +1,8 @@ const states = global.get('homeassistant.homeAssistant.states') const lights = states['light.emma_bedroom_light'].state const duration = states['input_number.emma_bedroom_lights_off_delay'].state -const lux = states['sensor.emma_bedroom_illuminance'].state -const threshold = states['input_number.emma_bedroom_lux_threshold'].state +const lux = parseInt(states['sensor.emma_bedroom_illuminance'].state) +const threshold = parseInt(states['input_number.emma_bedroom_lux_threshold'].state) const sleeping = states['input_boolean.emma_sleeping'].state const payload = msg.payload const newDuration = duration * 60 diff --git a/second-floor-lighting/stairwell/on-off.js b/second-floor-lighting/stairwell/on-off.js index b8570d3..190aa3e 100644 --- a/second-floor-lighting/stairwell/on-off.js +++ b/second-floor-lighting/stairwell/on-off.js @@ -1,20 +1,24 @@ const states = global.get('homeassistant.homeAssistant.states') -const lights = states['light.stairwell_led_strip'].state +const stairwellLights = states['light.stairwell_led_strip'].state +const hallwayLights = states['light.hallway_overhead'].state +const earlyNightMode = states['binary_sensor.early_night_mode'].state +const nightMode = states['input_boolean.night_mode'].state +const goodnight = states['input_boolean.goodnight'].state const duration = states['input_number.stairwell_lights_off_delay'].state -const lux = states['sensor.stairwell_bottom_illuminance'].state -const threshold = states['input_number.stairwell_lux_threshold'].state +const lux = parseInt(states['sensor.stairwell_bottom_illuminance'].state) +const threshold = parseInt(states['input_number.stairwell_lux_threshold'].state) const payload = msg.payload const newDuration = duration * 60 if (payload === 'on') { - if (lux <= threshold || lights === 'on') { + if (lux <= threshold || stairwellLights === 'on') { node.status({fill:'green',shape:'dot',text:'Lights On'}) node.send([msg,null]) } else { node.status({fill:'red',shape:'ring',text:'Too bright'}) } } else if (payload === 'off') { - if (lights === 'on') { + if (stairwellLights === 'on') { msg.duration = newDuration node.status({fill:"green",shape:"dot",text:parseInt(duration) + ' minutes'}) node.send([null,msg]) diff --git a/second-floor-lighting/upstairs-bathroom/motion-detected.js b/second-floor-lighting/upstairs-bathroom/motion-detected.js index a7599df..2c381f0 100644 --- a/second-floor-lighting/upstairs-bathroom/motion-detected.js +++ b/second-floor-lighting/upstairs-bathroom/motion-detected.js @@ -1,8 +1,8 @@ const states = global.get('homeassistant.homeAssistant.states') const lights = states['light.upstairs_bathroom_lights'].state const duration = states['input_number.upstairs_bathroom_motion_off_delay'].state -const lux = states['sensor.upstairs_bathroom_illuminance'].state -const threshold = states['input_number.upstairs_bathroom_lux_threshold'].state +const lux = parseInt(states['sensor.upstairs_bathroom_illuminance'].state) +const threshold = parseInt(states['input_number.upstairs_bathroom_lux_threshold'].state) const showerMode = states['input_boolean.shower_mode'].state const payload = msg.payload const newDuration = duration * 60