Files
HA-NerdFlows-Functions/front-porch/if-motion.js
2023-09-28 12:28:27 -04:00

12 lines
396 B
JavaScript

const states = global.get('homeassistant.homeAssistant.states')
const deliveryMode = states['input_boolean.delivery_mode'].state
const detect = msg.detect
node.send([null,msg])
if (detect === 'motion' && deliveryMode === 'on') {
node.status({fill:"green",shape:"dot",text:"Motion/Delivery"})
node.send([msg,null])
} else {
node.status({fill:"green",shape:"dot",text:"Not Motion"})
}