11 lines
423 B
JavaScript
11 lines
423 B
JavaScript
const states = global.get('homeassistant.homeAssistant.states')
|
|
const luxThreshold = states['input_number.living_room_lux_threshold'].state
|
|
const timer = states['timer.sunset_lighting_timer'].state
|
|
const payload = msg.payload
|
|
|
|
if (timer === 'active' && payload <= luxThreshold) {
|
|
node.status({fill:'green',shape:'dot',text:'Sent'})
|
|
node.send(msg)
|
|
} else {
|
|
node.status({fill:'red',shape:'ring',text:'Blocked'})
|
|
} |