Outils pour utilisateurs

Outils du site


mesh_et_mqtt

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
mesh_et_mqtt [2020/04/06 13:00] – [APPLICATION] BILLARDmesh_et_mqtt [2020/10/29 13:58] (Version actuelle) – ↷ Liens modifiés en raison d'un déplacement. serge
Ligne 1: Ligne 1:
-===== Réseau MESH avec des ESP et MQtt =====+====== Réseau MESH avec des ESP et MQtt ======
  
 L'objectif était de mettre en œuvre les informations contenues dans un article paru dans HACKABLE Magazine [[https://www.hackable.fr/?p=1142|27]] dans le contexte de l'internet des objets. L'objectif était de mettre en œuvre les informations contenues dans un article paru dans HACKABLE Magazine [[https://www.hackable.fr/?p=1142|27]] dans le contexte de l'internet des objets.
Ligne 5: Ligne 5:
 La structure est la suivante : La structure est la suivante :
  
-{{:mesh_design_schema_principe.png?200|}}+{{media_08:mesh_design_schema_principe.png?200|}}
  
 Choix du matériel. Choix du matériel.
Ligne 11: Ligne 11:
 Pour ce faire j'ai opté pour l'utilisation de ce type de carte : Pour ce faire j'ai opté pour l'utilisation de ce type de carte :
 //ESP8266 ESP-01 Module de relais WiFi 2 canaux Module de relais 2 canaux pour contrôleur d'application de téléphone intelligent IOT// disponible en chine . //ESP8266 ESP-01 Module de relais WiFi 2 canaux Module de relais 2 canaux pour contrôleur d'application de téléphone intelligent IOT// disponible en chine .
-{{::esp2relaiscarte.jpg?200|}}+{{media_03:esp2relaiscarte.jpg?200|}}
  
 Le programmateur utilisé est celui-ci : Le programmateur utilisé est celui-ci :
Ligne 94: Ligne 94:
 Exemple de flow pour Node-Red   Exemple de flow pour Node-Red  
  
-{{::le_diagramme_node-red_de_test.jpg?400|}}{{ :visu_diagramme_node-red_de_test.jpg?400|}}+{{ pliboo-02:flows.zip |}} 
 + 
 +{{media_07:le_diagramme_node-red_de_test.jpg?400|}}{{ :visu_diagramme_node-red_de_test.jpg?400|}}
  
 Le fichier json pour Node-Red. Le fichier json pour Node-Red.
 +
 +Un exemple de bouton poussoir Node-red avec changement de couleur et init à la mise sous-tension. 
 +
 +Illustration de boutons dynamique.
 +
 +{{media_04:bouton_poussoir_node_red.png?direct&200|}}
 +
 +**Reste à gérer les interaction entre les boutons, dans le cas d'une carte disposant de trois boutons R1/R2/R1 et 2 et la création d'un subflow paramétrable. Aide bienvenue -- MERCI**
  
 <code> <code>
-[ +[{"id":"5e5c2e88.71aea","type":"ui_button","z":"d68fea03.31b0c8","name":"Bouton Poussoir","group":"65e2fa0d.4fb70c","order":0,"width":0,"height":0,"passthru":false,"label":"{{msg.state}}","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"true","payloadType":"bool","topic":"","x":450,"y":280,"wires":[["d450f8d3.7b7b1"]]},{"id":"7e81c5e9.f34c3c","type":"inject","z":"d68fea03.31b0c8","name":"","topic":"","payload":"reset","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":400,"y":220,"wires":[["d450f8d3.7b7b1"]]},{"id":"d450f8d3.7b7b1","type":"function","z":"d68fea03.31b0c8","name":"gestion BP","func":"\nvar state=context.get(\"state\") || \"OFF\";\n\nvar color = '';\nif (msg.payload===\"reset\") {\n    state=\"OFF\"\n    color = 'red';\n    txt = \"OFF\"\n    msg.state=\"ON\";\n}\nelse{\n\nif ((msg.payload===true) && (state==\"OFF\")) {\n    state=!state;\n    context.set(\"state\",\"ON\") ;\n    msg.payload=\"RON#1\";\n    color = \"green\";\n    txt = \"ON\"\n    msg.state=\"OFF\";\n\n\nelse {\n    msg.payload=\"ROFF#1\";\n    context.set(\"state\",\"OFF\") ;\n    color = 'red';\n    txt = \"OFF\"\n    msg.state=\"ON\";\n}\n}\n\n node.status({\n    \tfill : color,\n    \tshape 'dot',\n    \ttext txt\n });\nnode.send(msg);\nmsg.background=color;\n\n\n\nreturn msg;\n","outputs":1,"noerr":0,"x":690,"y":280,"wires":[["5e5c2e88.71aea"]]},{"id":"65e2fa0d.4fb70c","type":"ui_group","z":"","name":"Carte 1 V2","tab":"3939b51c.a31712","disp":true,"width":"6","collapse":true},{"id":"3939b51c.a31712","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
-    { +
-        "id": "ddc64b3f.c6186", +
-        "type": "tab", +
-        "label": "Tests MQTT -- BROKER", +
-        "disabled": false, +
-        "info": "# TEST de commande du mesh via MQTT" +
-    }, +
-    { +
-        "id": "f999e073.5d47", +
-        "type": "rpi-gpio out", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "pin": "26", +
-        "set": "", +
-        "level": "0", +
-        "freq": "", +
-        "out": "out", +
-        "x": 260, +
-        "y": 120, +
-        "wires": [] +
-    }, +
-    { +
-        "id": "fa316b06.22b718", +
-        "type": "ui_switch", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "label": "LED RPI", +
-        "tooltip": "", +
-        "group": "8527305a.23bfe", +
-        "order": 2, +
-        "width": 0, +
-        "height": 0, +
-        "passthru": true, +
-        "decouple": "false", +
-        "topic": "", +
-        "style": "", +
-        "onvalue": "true", +
-        "onvalueType": "bool", +
-        "onicon": "", +
-        "oncolor": "", +
-        "offvalue": "false", +
-        "offvalueType": "bool", +
-        "officon": "", +
-        "offcolor": "", +
-        "x": 80, +
-        "y": 120, +
-        "wires":+
-            [ +
-                "f999e073.5d47" +
-            ] +
-        ] +
-    }, +
-    { +
-        "id": "b72ce8cf.836678", +
-        "type": "mqtt out", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "topic": "painlessMesh/to/gateway", +
-        "qos": "", +
-        "retain": "", +
-        "broker": "d36dd4f9.975f18", +
-        "x": 480, +
-        "y": 380, +
-        "wires": [] +
-    }+
-    { +
-        "id": "8b6acbff.091e4", +
-        "type": "ui_button", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "group": "f21e6545.83f818", +
-        "order": 3, +
-        "width": 0, +
-        "height": 0, +
-        "passthru": false, +
-        "label": "getNodes", +
-        "tooltip": "", +
-        "color": "", +
-        "bgcolor": "", +
-        "icon": "", +
-        "payload": "getNodes", +
-        "payloadType": "str", +
-        "topic": "", +
-        "x": 110, +
-        "y": 380, +
-        "wires": [ +
-            [ +
-                "b72ce8cf.836678" +
-            ] +
-        ] +
-    }, +
-    { +
-        "id": "67b2c450.923da4", +
-        "type": "ui_button", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "group": "f21e6545.83f818", +
-        "order": 8, +
-        "width": 0, +
-        "height": 0, +
-        "passthru": false, +
-        "label": "Reset Pont", +
-        "tooltip": "", +
-        "color": "", +
-        "bgcolor": "", +
-        "icon": "", +
-        "payload": "0", +
-        "payloadType": "str", +
-        "topic": "", +
-        "x": 130, +
-        "y": 200, +
-        "wires": +
-            [ +
-                "a2842bf9.64e998" +
-            ] +
-        ] +
-    }, +
-    { +
-        "id": "c97fc65.1165338", +
-        "type": "mqtt in", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "topic": "#", +
-        "qos": "2", +
-        "datatype": "auto", +
-        "broker": "d36dd4f9.975f18", +
-        "x": 100, +
-        "y": 300, +
-        "wires": [ +
-            [ +
-                "eb3df9d9.56a158" +
-            ] +
-        ] +
-    }, +
-    { +
-        "id": "eb3df9d9.56a158", +
-        "type": "ui_text", +
-        "z": "ddc64b3f.c6186", +
-        "group": "f21e6545.83f818", +
-        "order": 6, +
-        "width": 0, +
-        "height": 0, +
-        "name": "", +
-        "label": "Du mesh"+
-        "format""{{msg.payload}}"+
-        "layout""row-spread", +
-        "x": 420, +
-        "y": 300, +
-        "wires": [] +
-    }, +
-    +
-        "id": "594a7bf6.2dc26c"+
-        "type": "ui_button", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "group": "f21e6545.83f818", +
-        "order": 7, +
-        "width": 0, +
-        "height": 0, +
-        "passthru": false, +
-        "label": "Coucou PONT /broadcast", +
-        "tooltip": "", +
-        "color": "", +
-        "bgcolor": "", +
-        "icon": "", +
-        "payload""Coucou du PONT", +
-        "payloadType": "str", +
-        "topic": "", +
-        "x": 140, +
-        "y": 460, +
-        "wires":+
-            [ +
-                "32a4b05f.e80c08" +
-            ] +
-        ] +
-    }, +
-    +
-        "id": "32a4b05f.e80c08"+
-        "type": "mqtt out", +
-        "z": "ddc64b3f.c6186"+
-        "name": "", +
-        "topic": "painlessMesh/to/broadcast", +
-        "qos": "", +
-        "retain": "", +
-        "broker": "d36dd4f9.975f18", +
-        "x": 500, +
-        "y": 460, +
-        "wires": [] +
-    }, +
-    { +
-        "id": "6f9ab855.d9f018", +
-        "type": "mqtt out", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "topic": "painlessMesh/to/ 2393369193", +
-        "qos": "", +
-        "retain": "", +
-        "broker": "d36dd4f9.975f18", +
-        "x": 460, +
-        "y": 720, +
-        "wires": [] +
-    }, +
-    { +
-        "id": "1e27b8a8.168b2f", +
-        "type": "ui_switch", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "label": "ON/OFF All"+
-        "tooltip": "", +
-        "group": "25347a33.431976", +
-        "order": 10, +
-        "width": 0, +
-        "height": 0, +
-        "passthru": true, +
-        "decouple": "false", +
-        "topic": "", +
-        "style": "", +
-        "onvalue": "RONA", +
-        "onvalueType": "str", +
-        "onicon": "", +
-        "oncolor": "", +
-        "offvalue": "ROFFA", +
-        "offvalueType": "str", +
-        "officon": "", +
-        "offcolor": "", +
-        "x": 90, +
-        "y": 620, +
-        "wires":+
-            [ +
-                "6f9ab855.d9f018" +
-            ] +
-        ] +
-    }, +
-    { +
-        "id": "5395996.41098e8"+
-        "type": "ui_switch", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "label": "ON/ OFF R1"+
-        "tooltip": "", +
-        "group": "25347a33.431976", +
-        "order": 9, +
-        "width": 0, +
-        "height": 0, +
-        "passthru": true, +
-        "decouple": "false", +
-        "topic": "", +
-        "style": "", +
-        "onvalue": "RON1", +
-        "onvalueType": "str", +
-        "onicon": "", +
-        "oncolor": "", +
-        "offvalue": "ROFF1", +
-        "offvalueType": "str", +
-        "officon": "", +
-        "offcolor": "", +
-        "x": 90, +
-        "y": 680, +
-        "wires":+
-            [ +
-                "6f9ab855.d9f018" +
-            ] +
-        ] +
-    }+
-    +
-        "id": "e5cb4820.b12d38"+
-        "type": "ui_switch", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "label": "ON/OFF R2 "+
-        "tooltip": "", +
-        "group": "25347a33.431976", +
-        "order": 7, +
-        "width": 0, +
-        "height": 0, +
-        "passthru": true, +
-        "decouple": "false", +
-        "topic": "", +
-        "style": "", +
-        "onvalue": "RON2", +
-        "onvalueType": "str", +
-        "onicon": "", +
-        "oncolor": "", +
-        "offvalue": "ROFF2", +
-        "offvalueType": "str", +
-        "officon": "", +
-        "offcolor": "", +
-        "x": 90, +
-        "y": 740, +
-        "wires":+
-            [ +
-                "6f9ab855.d9f018" +
-            ] +
-        ] +
-    }, +
-    +
-        "id": "a7dc41d7.c217c8", +
-        "type": "mqtt in", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "topic": "painlessMesh/etatBridge", +
-        "qos": "2", +
-        "datatype": "auto", +
-        "broker": "d36dd4f9.975f18", +
-        "x": 180, +
-        "y": 260, +
-        "wires":+
-            [ +
-                "a2842bf9.64e998" +
-            ] +
-        ] +
-    }, +
-    { +
-        "id": "a2842bf9.64e998"+
-        "type": "ui_text", +
-        "z": "ddc64b3f.c6186", +
-        "group": "f21e6545.83f818", +
-        "order": 3, +
-        "width": "6", +
-        "height": "1", +
-        "name": "", +
-        "label": "Etat du Pont", +
-        "format": "{{msg.payload}}", +
-        "layout": "row-left", +
-        "x": 450, +
-        "y": 260, +
-        "wires": [], +
-        "icon": "node-red/bridge-dash.svg" +
-    }, +
-    { +
-        "id""5d17d261.ab0cbc", +
-        "type": "ui_button", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "group": "25347a33.431976", +
-        "order": 5, +
-        "width": 0, +
-        "height": 0, +
-        "passthru": false, +
-        "label": "Type de Noeud", +
-        "tooltip": "", +
-        "color": "", +
-        "bgcolor""", +
-        "icon""", +
-        "payload": "TYPE", +
-        "payloadType": "str", +
-        "topic": "", +
-        "x": 110, +
-        "y": 820, +
-        "wires":+
-            [ +
-                "6f9ab855.d9f018" +
-            ] +
-        ] +
-    }+
-    { +
-        "id": "dc8b9afc.20a36", +
-        "type": "ui_switch", +
-        "z": "ddc64b3f.c6186", +
-        "name": "", +
-        "label": "switch", +
-        "tooltip": "", +
-        "group": "25347a33.431976", +
-        "order": 5, +
-        "width": 0, +
-        "height": 0, +
-        "passthru": true, +
-        "decouple": "false", +
-        "topic": "", +
-        "style": "", +
-        "onvalue": "RON0", +
-        "onvalueType": "str", +
-        "onicon": "", +
-        "oncolor": "", +
-        "offvalue": "ROFF0", +
-        "offvalueType": "str", +
-        "officon": "", +
-        "offcolor": "", +
-        "x": 100, +
-        "y": 560, +
-        "wires": [ +
-            [ +
-                "6f9ab855.d9f018" +
-            ] +
-        ] +
-    }, +
-    { +
-        "id": "8527305a.23bfe", +
-        "type": "ui_group", +
-        "z": "", +
-        "name": "RPI", +
-        "tab": "3939b51c.a31712", +
-        "disp": true, +
-        "width": "6", +
-        "collapse": false +
-    }, +
-    { +
-        "id": "d36dd4f9.975f18", +
-        "type": "mqtt-broker", +
-        "z": "", +
-        "name": "PI", +
-        "broker": "192.168.50.15", +
-        "port": "1883", +
-        "clientid": "MOSQUITTO_PI", +
-        "usetls": false, +
-        "compatmode": false, +
-        "keepalive": "60", +
-        "cleansession": true, +
-        "birthTopic": "", +
-        "birthQos": "0", +
-        "birthPayload": "", +
-        "closeTopic": "", +
-        "closeQos": "0", +
-        "closePayload": "", +
-        "willTopic": "", +
-        "willQos": "0", +
-        "willPayload": "" +
-    }, +
-    { +
-        "id": "f21e6545.83f818", +
-        "type": "ui_group", +
-        "z": "", +
-        "name": "Etat du pont", +
-        "tab": "3939b51c.a31712", +
-        "disp": true, +
-        "width": "6", +
-        "collapse": false +
-    }, +
-    { +
-        "id": "25347a33.431976", +
-        "type": "ui_group", +
-        "z": "", +
-        "name": "Carte 1", +
-        "tab": "3939b51c.a31712", +
-        "disp": true, +
-        "width": "6", +
-        "collapse": false +
-    }, +
-    { +
-        "id": "3939b51c.a31712", +
-        "type": "ui_tab", +
-        "z": "", +
-        "name": "Home", +
-        "icon": "dashboard", +
-        "disabled": false, +
-        "hidden": false +
-    } +
-]+
 </code> </code>
 +
 +
 +
 +
 +
 +
  
 La partie iptable n'est pas mise en oeuvre du fait d'un changement dans Buster [[https://www.debian.org/releases/jessie/mips64el/release-notes/ch-whats-new.fr.html#nftables.|iptables vers nftables]] La partie iptable n'est pas mise en oeuvre du fait d'un changement dans Buster [[https://www.debian.org/releases/jessie/mips64el/release-notes/ch-whats-new.fr.html#nftables.|iptables vers nftables]]
mesh_et_mqtt.1586178028.txt.gz · Dernière modification : 2020/04/06 13:00 de BILLARD