node-red-contrib-radio-emi

Use a C++ programm to control Chacon DIO outlets

This flow allows to execute a C++ program in function of the name of the msg.payload whose arrive in enter of the node “Filtre Emission”. These msg.payload are “prise_X_Y”, with X = 1-2-3, and Y = ON-OFF. The C++ program can be recover on this web site : https://arno0x0x.wordpress.com/2015/04/02/rf433-outlet/ For more informations on the C++ program : http://blog.idleman.fr/raspberry-pi-12-allumer-des-prises-distance/ Place the C++ program in the directory : /root/.node-red/

References to IR : https://www.npmjs.com/package/node-red-contrib-lirc-easy

[{"id":"ddef63c6.dece","type":"function","z":"93b06d9e.a9787","name":"Filtre Emission","func":"var ws = msg.payload;\n\nif(ws==\"emiprise_1_on\" || ws==\"prise_1_onemi\"){ //Si appui sur le bouton 1 ON de la télécommande virtuelle\n    var msg1 = { payload:\"/root/.node-red/radioPack/chacon_send 0 12325261 1 on\" }; //Création d'un objet comprenant la ligne de commande qui execute le programme en C++\n    return [msg1]; //On retourne ce message vers la sortie de la node\n}\n\nif(ws==\"emiprise_1_off\" || ws==\"prise_1_offemi\"){\n    var msg1 = { payload:\"/root/.node-red/radioPack/chacon_send 0 12325261 1 off\" };\n    return [msg1];   \n}\n\nif(ws==\"emiprise_2_on\" || ws==\"prise_2_onemi\"){\n    var msg1 = { payload:\"/root/.node-red/radioPack/chacon_send 0 12325261 2 on\" };\n    return [msg1];\n}\n\nif(ws==\"emiprise_2_off\" || ws==\"prise_2_offemi\"){\n    var msg1 = { payload:\"/var/www/chacon_send 0 12325261 2 off\" };\n    return [msg1];\n}\n\nif(ws==\"emiprise_3_on\" || ws==\"prise_3_onemi\"){\n    var msg1 = { payload:\"/var/www/chacon_send 0 12325261 3 on\" };\n    return [msg1];\n}\n\nif(ws==\"emiprise_3_off\" || ws==\"prise_3_offemi\"){\n    var msg1 = { payload:\"/var/www/chacon_send 0 12325261 3 off\" };\n    return [msg1];\n}","outputs":1,"noerr":0,"x":397,"y":448.00000858306885,"wires":[["b4b351e6.4f91e","c620f3e8.5ebef"]]},{"id":"64e58e50.5116c","type":"debug","z":"93b06d9e.a9787","name":"","active":true,"console":"false","complete":"false","x":795,"y":435.00000858306885,"wires":[]},{"id":"b4b351e6.4f91e","type":"debug","z":"93b06d9e.a9787","name":"","active":true,"console":"false","complete":"false","x":625,"y":499.00000858306885,"wires":[]},{"id":"c620f3e8.5ebef","type":"exec","z":"93b06d9e.a9787","command":"","addpay":true,"append":"","useSpawn":"","timer":"","name":"Exec Prises","x":625,"y":448.50000858306885,"wires":[["64e58e50.5116c"],[],[]]},{"id":"96e683d0.e60c4","type":"join","z":"93b06d9e.a9787","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"","timeout":"","count":"2","x":234,"y":448.00000858306885,"wires":[["ddef63c6.dece"]]}]

Flow Info

Created 8 years, 3 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x2)
  • exec (x1)
  • function (x1)
  • join (x1)

Tags

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