Tweak some upstairs motion lighting parameters when E is sleeping

This commit is contained in:
2025-09-02 02:46:08 -04:00
parent f63baaef48
commit 4aa305c9d2
2 changed files with 16 additions and 9 deletions

View File

@@ -5,7 +5,8 @@ const lux = parseInt(states['sensor.master_bedroom_illuminance'].state)
const threshold = parseInt(states['input_number.master_bedroom_lux_threshold'].state)
const masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state
const kallenBedroomSleep = states['input_boolean.kallen_sleeping'].state
const peopleSleeping = (masterBedroomSleep === 'on' || kallenBedroomSleep === 'on')
const emmaBedroomSleep = states['input_boolean.emma_sleeping'].state
const peopleSleeping = (masterBedroomSleep === 'on' || kallenBedroomSleep === 'on' || emmaBedroomSleep === 'on')
const nightMode = states['input_boolean.night_mode'].state
const payload = msg.payload
const newDuration = duration * 60

View File

@@ -2,11 +2,17 @@ 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 = 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 emmaBedroomSleep = states['input_boolean.emma_sleeping'].state
const payload = msg.payload
const newDuration = duration * 60
let threshold = parseInt(states['input_number.upstairs_bathroom_lux_threshold'].state)
if (emmaBedroomSleep === 'on') {
threshold = 10
}
let timerCancel = {
"payload": "stop"
}
@@ -32,11 +38,11 @@ if (showerMode === 'off') {
}
node.log("----- Upstairs Bathroom Motion Parameters Start -----")
node.log("Upstairs Bathroom payload: " + payload)
node.log("Upstairs Bathroom lights: " + lights)
node.log("Upstairs Bathroom duration: " + duration)
node.log("Upstairs Bathroom newDuration: " + newDuration)
node.log("Upstairs Bathroom lux: " + lux)
node.log("Upstairs Bathroom threshold: " + threshold)
node.log("Upstairs Bathroom showerMode: " + showerMode)
node.log(`Upstairs Bathroom payload: ${payload}`)
node.log(`Upstairs Bathroom lights: ${lights}`)
node.log(`Upstairs Bathroom duration: ${duration}`)
node.log(`Upstairs Bathroom newDuration: ${newDuration}`)
node.log(`Upstairs Bathroom lux: ${lux}`)
node.log(`Upstairs Bathroom threshold: ${threshold}`)
node.log(`Upstairs Bathroom showerMode: ${showerMode}`)
node.log("----- Upstairs Bathroom Motion Parameters End -----")