Optical Sensor AGILE Demo
This is a flow which can be used to setup a simple optical sensor demo on the Sensor Tag with AGILE. The threshold can be set in the Light Switch, based on which the LED0 on the Sensor Tag will turn on and off.
[{"id":"8b9c765e.3b1e48","type":"function","z":"dc99baf6.10da6","name":"Light Switch","func":"msg.url={}\nif(msg.payload.value<100)\n{\n msg.url=\"http://agile:8080/api/device/\"+msg.payload.deviceID+\"/execute/\"+\"TURN_ON_LED1\"\n return msg;\n}\nelse\n{\n msg.url=\"http://agile:8080/api/device/\"+msg.payload.deviceID+\"/execute/\"+\"TURN_OFF_ALL\"\n return msg;\n}","outputs":"1","noerr":0,"x":481,"y":236,"wires":[["18e84800.551398"]]},{"id":"271e28ce.32f968","type":"agile-device-subscribe","z":"dc99baf6.10da6","server":"61bd672b.fe0ea8","name":"","deviceId":"bleA0E6F8AF2A81","componentId":"Optical","x":219,"y":229,"wires":[["8b9c765e.3b1e48"]]},{"id":"18e84800.551398","type":"http request","z":"dc99baf6.10da6","name":"POST STATE","method":"POST","ret":"txt","url":"","tls":"","x":700,"y":257,"wires":[["24ca0688.8d6d7a"]]},{"id":"24ca0688.8d6d7a","type":"debug","z":"dc99baf6.10da6","name":"","active":false,"console":"false","complete":"false","x":922,"y":233,"wires":[]},{"id":"61bd672b.fe0ea8","type":"agile-config-server","z":"","host":"agile","port":"8080"}]