Paso 3: Implementar BuzzedByA flujo de trabajo en la Edison B (Charles)
En el editor de RED nodo de Edison B (Charles), crear una ficha llamada "BuzzedByA" (Buzzed por Johnny).
Copia el siguiente texto JSON:
[{"id":"5ecbb367.a1344c","type":"http request","name":"Get Johnnys Edison Button On-Off Status","method":"GET","ret":"txt","url":"http://atlantisjc.local:1880/isbuttoned","x":351,"y":228,"z":"9f7039b8.608fc8","wires":[["11a43181.ee5bce","443cbbb2.bbc344"]]},{"id":"5678e01e.a9872","type":"inject","name":"GET Johnny API every 1 second","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":195,"y":167,"z":"9f7039b8.608fc8","wires":[["5ecbb367.a1344c"]]},{"id":"11a43181.ee5bce","type":"debug","name":"","active":false,"console":"false","complete":"payload","x":638,"y":222,"z":"9f7039b8.608fc8","wires":[]},{"id":"84425c56.7bbda","type":"debug","name":"","active":false,"console":"false","complete":"false","x":749,"y":347,"z":"9f7039b8.608fc8","wires":[]},{"id":"e5365b33.1ac9a8","type":"function","name":"Json2Number","func":"if (msg.payload.isButtoned == 1) {\n msg.payload = 1;\n} else {\n msg.payload = 0;\n}\nreturn msg;","outputs":1,"noerr":0,"x":572,"y":354,"z":"9f7039b8.608fc8","wires":[["84425c56.7bbda","65964c01.9a69b4"]]},{"id":"65964c01.9a69b4","type":"rbe","name":"","func":"rbe","gap":"","x":677,"y":425,"z":"9f7039b8.608fc8","wires":[["e983efdb.167c1","2559d548.daa62a"]]},{"id":"e983efdb.167c1","type":"debug","name":"","active":true,"console":"false","complete":"false","x":833,"y":405,"z":"9f7039b8.608fc8","wires":[]},{"id":"443cbbb2.bbc344","type":"json","name":"","x":414,"y":299,"z":"9f7039b8.608fc8","wires":[["e5365b33.1ac9a8","fa06a34f.05f96"]]},{"id":"fa06a34f.05f96","type":"debug","name":"","active":false,"console":"false","complete":"false","x":583,"y":285,"z":"9f7039b8.608fc8","wires":[]},{"id":"2559d548.daa62a","type":"mraa-gpio-dout","name":"D7-buzzer","pin":"7","set":true,"level":"0","x":816,"y":474,"z":"9f7039b8.608fc8","wires":[]}]
En nodo rojo, haz clic en el botón de menú de la parte superior derecha-> Importar -> Portapapeles.
Pegue el texto JSON y haga clic en Aceptar.
El flujo de trabajo de "BuzzedByA" (zumbó por Johnny) se implementa en Edison B (Charles).
¿Qué hace este flujo de trabajo?
- GET petición de Edison (Johnny) en cada intervalo de segunda.
- Si el valor de "isButtoned" (en A Edison) es 1, luego encender zumbador (Edison B). De lo contrario, apague el timbre.
- Usar los nodos de depuración para ver qué valores de la carga útil se se pasan - para propósitos de depuración.
A continuación, vamos a probar el sistema (hasta ahora) una forma animado!