Fix issues with lux threshold conditions
This commit is contained in:
@ -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
|
||||
|
||||
|
@ -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') {
|
||||
|
Reference in New Issue
Block a user