On my third day I am making new discoveries. Previously I used polling to get events such as pushing a button. This is too slow, wasteful of computer resources and might even miss the event if I am not polling fast enough. Another method is to use interrupts or ‘events’ using websockets.
Seeedo does all the hard work for you. Just select ‘events’ on the Android or Ios App, download the firmware and cut and paste the ip and access token into the selected node-red nodes. I am hosting node-red on a Beaglebones Green computer and WioLink (here Wio02) is a front end for Grove IO with results on my Windows Chrome browser. All you have to so is cut and paste the access token into an ‘inject node’ on node-red and insert two websocket nodes - one for in and one for out. You can access the payload from the out websocket node and do want you want with it - either add extra nodes for processing or a node function and program it in javascript. I have only captured it with a debug node for demo.
Its all interrupt processing with non block programming using callbacks and events. It is more efficient and works on every event. You can set all of this up within 1 minute! The diagrams below show the node-red flow and dialogs for the websocket nodes.For the hardware of this flow I am using a Grove PIR module that captures every IR event.
I still have to add the processing for the alerts tones to the speakers but that is easy and I have tested the speaker interface separately. Don’t expect music - potential transmitted frequencies are minimal (only 4 are support on a single musically scale (A to G).
If you want any of the flows give me feedback and I will add them. Then you can paste them into your own node-red canvas.
Post-edit: take care when posting like this so as not to include either your or in the diagrams. I have since removed these. Read your posting carefully. Also this method is not secure as the payload includes the Access Token. As a suggestion, the team at Seeedo Studio could remove the access token from the return payload. It is not need then. In the future secure protocols should be used for real projects.
Ref: Example 3.7 Using Websockets with Node-RED on Node-RED: Lecture 3 – Basic nodes and flows at University of Waterloo (http://noderedguide.com/index.php/2015/10/28/node-red-lecture-3-basic-nodes-and-flows/ ). You can host your node-red either there or on a Raspberry Pi, Beaglebone Black, Green computer or even a Mac or Windows PC.