Presence Detection via ARP
This flow detects if hosts are presence in the network based on MAC adres. It does this by using a program called arp-scan. Arp-scan can be installed via: "sudo apt-get install arp-scan"
[{"id":"4eee93b4.b1116c","type":"function","z":"1b72c880.e48d38","name":"Detect Presence","func":"const triggers = 10;\nconst MAC = \"00:00:00:00:00:00\";\nvar count = context.count||0;\n\nif(msg.payload.indexOf(MAC)>0){\n if(count < 1){\n msg.payload = 1;\n count = triggers;\n context.count = count;\n return msg;\n }else count = triggers;\n \n}else{\n count -= 1;\n if(count === 0){\n msg.payload = 0;\n context.count = count;\n return msg;\n }else if(count < 0){\n count = 0; \n }\n}\ncontext.count = count;\n","outputs":1,"noerr":0,"x":522,"y":247,"wires":[["f47394e8.0b8c68"]]},{"id":"7e3bc8dd.81c438","type":"exec","z":"1b72c880.e48d38","command":"sudo arp-scan --interface=eth0 --localnet","addpay":false,"append":"","useSpawn":"","name":"Arp-Scan","x":327,"y":259.5,"wires":[["4eee93b4.b1116c"],[],[]]},{"id":"7547f391.8ab80c","type":"inject","z":"1b72c880.e48d38","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"10","crontab":"","once":true,"x":102,"y":260,"wires":[["7e3bc8dd.81c438"]]},{"id":"f47394e8.0b8c68","type":"debug","z":"1b72c880.e48d38","name":"","active":true,"console":"false","complete":"false","x":732,"y":245,"wires":[]}]