AgileMonitorLight

This node-red flow monitors the brightness of the room through Agile Restful API using TI-SensorTag, and turn on the light bulb if it the brightness is below some threshold

[{"id":"761d09fb.3b2df8","type":"influxdb","z":"c803d37d.da33a","hostname":"localhost","port":"8086","database":"TISensorTag","name":""},{"id":"20ce1ff5.dbad1","type":"inject","z":"c803d37d.da33a","name":"Inject","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":true,"x":326,"y":532,"wires":[["1a43cb95.166414"]]},{"id":"1a43cb95.166414","type":"http request","z":"c803d37d.da33a","name":"ReadOpticalSensor","method":"GET","ret":"obj","url":"http://localhost:8080/api/device/bleC4BE84706909/Optical","x":508,"y":531,"wires":[["9833f925.b1e528"]]},{"id":"9833f925.b1e528","type":"function","z":"c803d37d.da33a","name":"ParseResult","func":"msg.payload = parseInt(msg.payload.value);\nreturn msg;","outputs":1,"noerr":0,"x":695,"y":531,"wires":[["b99a2fd8.f601d","45bf6095.630a4","3d31b199.df659e"]]},{"id":"45bf6095.630a4","type":"debug","z":"c803d37d.da33a","name":"Print","active":true,"console":"false","complete":"payload","x":833,"y":360,"wires":[]},{"id":"b99a2fd8.f601d","type":"influxdb out","z":"c803d37d.da33a","influxdb":"761d09fb.3b2df8","name":"write data to influxdb","measurement":"OpticalReading","x":842,"y":728,"wires":[]},{"id":"3d31b199.df659e","type":"switch","z":"c803d37d.da33a","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"50","vt":"num"},{"t":"gt","v":"50","vt":"str"}],"checkall":"true","outputs":2,"x":860,"y":542,"wires":[["4228b988.5c7928"],["b8d91ad8.b4a0a8"]]},{"id":"4228b988.5c7928","type":"exec","z":"c803d37d.da33a","command":"curl -X POST 'http://localhost:8080/api/device/ZB_000000000000FFFF/execute/on'","addpay":false,"append":"","useSpawn":"","name":"TurnOn","x":1036,"y":428.5,"wires":[[],[],[]]},{"id":"b8d91ad8.b4a0a8","type":"exec","z":"c803d37d.da33a","command":"curl -X POST 'http://localhost:8080/api/device/ZB_000000000000FFFF/execute/off'","addpay":true,"append":"","useSpawn":"","name":"TurnOff","x":1031,"y":638.5,"wires":[[],[],[]]}]
doitdagi

Flow Info

created 10 months, 2 weeks ago

Node Types

Core
  • debug (x1)
  • exec (x2)
  • function (x1)
  • http request (x1)
  • inject (x1)
  • switch (x1)
Other

Tags

Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option