Using Thingspeak React with "dynamic" channels

13 visualizzazioni (ultimi 30 giorni)
Ben Alimansky
Ben Alimansky il 17 Set 2020
Risposto: Vinod il 17 Set 2020
Hi Vinod - you helped me a few minutes ago with a question about how to work with multiple devices which were all updating Thingspeak concurrently. Your suggestion of dynamically creating a dynamic, for each respective device, makes sense.
However, I have a related issue. I have a React app (in Thingspeak) that triggers a Matlab Analysis script on data insertion to the single channel that I'm using today. As I go to implement a multi-channel approach, do you have any thoughts on how I can use React across channels that I am creating "dynamically"? The React parameters (via the Thingspeak website) seem to specify the channel that you're monitoring - and I'm not sure how to do this in a more dynamic way.
Thank you!
Ben

Risposte (1)

Vinod
Vinod il 17 Set 2020
My recommendation would be to set up a TimeControl that triggers MATLAB code that reads data across all your channels. Your MATLAB code can use the same REST APIs as your devices to find all the channels and their API keys and then read the last 10 minutes of data across all of the channels and do the operations you need. With MATLAB code you can get much more control over the conditions under which you want something to happen, and a much wider range of actions that you can have the MATLAB code perform for you.
The one downside with this approach is that it is not instantaneous, unlike a react which monitors the data as it is inserted into the channel. Then again, this approach is a lot more flexible. I guess that is the sort of tradeoff that engineers have to consider all the time :)

Community

Più risposte nel  ThingSpeak Community

Categorie

Scopri di più su Read Data from Channel in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by