Two Reacts on the same channel | ThingSpeak Apps | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Two Reacts on the same channel
No permission to create posts
March 3, 2019
4:12 pm
Avatar
Nettlevodka
New Member
Members
Forum Posts: 3
Member Since:
March 3, 2019
sp_UserOfflineSmall Offline

Hello all! Noob here! Fingers crossed someone might have a quick answer?...

It seems that when I have Reacts on more than one field, each set to run "Only the first time the condition is met", a react firing in one field resets the memory of the last condition for the other field. So I'm getting continual firings for each field, as each resets the other, if that makes sense?

Just wondering if anyone has experience with this, or has a solution?

Cheers and thanks!
Nettlevodka (Michael)

March 4, 2019
12:48 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

What do you mean by "memory of the last condition for the other field"

Can you describe the exact settings of your reacts and the channel values for the target channel? Alternatively, you can describe what you want to do exactly and we can help you achieve it.

March 5, 2019
6:04 pm
Avatar
Nettlevodka
New Member
Members
Forum Posts: 3
Member Since:
March 3, 2019
sp_UserOfflineSmall Offline

Thanks for your reply. Re-reading, I was a bit obscure! Sorry!

I have a channel which is updated every 5 mins... 2 fields, one called Donald, one called Fence.

One field (Donald) is receiving a value 0 or 1 from a dB sensor. 0 = no sound, 1 = sound above my set threshold. It's telling me if and when and for how long my noisy diesel generator (Donald) is running,

The other field (called Fence) is receiving an analog EMF value from a wire near my 7000V pulsing electric fence. 0 = Fence not connected, value above 0 means fence is pulsing.

Everything is going well from a programming, UNO and LoRa perspective.

I want to be alerted by Facebook Messenger if Donald has started running or stopped running, or the Fence is connected or not connected. So I've done this...

1. Set up Webhooks in IFTTT to send me a FB message if called.
2. In ThingSpeak, I've set up for each channel...
-- 2 Reacts for each field E.g. "Donald is running" and "Donald is not running", "Fence is on", "Fence is off". If a React fires, it executes a ThingHTTP...
-- 2 ThingHTTPs (they call IFTTT)
3. When Donald starts, the field value goes from 0 to 1, the React kicks in, the ThingHTTP is executed, IFTTT acts and I get a FB message. Brilliant!
4. Same approach when Donald stops, and also for the two Fence conditions (on and off) as well. This all works very well...

Except, and here's the thing... Let's imagine Donald has started and he runs for 2 hours. The Donald field value will be set to value=1 every 5 mins for 2 hours. I want to know the first time it went to 1, but not another 24 times during the 2 hours. So I've set the React to...

--Activate On Data Insertion
--Run Only The First Time The Condition Is Met

This works brilliantly... I get a one single message saying Donald has started, and 2 hours later, my other React tells me Donald has stopped
I imagine the ThingSpeak internal coding behind this is saying something like "Fire, and 'remember' that this happened, and don't do it again if it's the same as last time because he'll get annoyed!".

BUT... when I added additional but similar Reacts targeting a different field (my Electric Fence), whenever a Fence React fired, I started getting repeat Donald messages. And the same with Fence messages. As though the firing of the React I've created for the fence has reset the 'remembered' last-firing of the React I created for Donald, and vice-versa.

So, the behaviour suggests that Reacts operate at the Channel level, but not at the field level. The implication being that for my scenario, I can only have Reacts for one field.

Or, and that brings me to my question really, do I have the wrong end of the stick? 🙂

Hope this description is better?

Thanks and cheers!
Michael

March 5, 2019
8:46 pm
Avatar
Vinod

MathWorks
Members
Forum Posts: 339
Member Since:
May 1, 2016
sp_UserOfflineSmall Offline

I'd suggest a different approach.

Create a MATLAB analysis app that reads the past 5 minutes of data from both your channels. Then, do a "diif" on the data from each channel to determine if the channel has switched state. Based on the diff of each channel you can write a simple if-else block that fires the appropriate IFTTT webhook.

Then, tie this MATLAB analysis to a TimeControl app, or, if you really wish immediate notification,

Use a MATLAB app that reads the last two points from each channel, do the same thing as above, and tie it to a React app which runs on-data-insert on either channel.

March 6, 2019
10:54 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

As Vinod says, the MATLAB analysis will give you a lot more control than just using multiple reacts. Additionally, you can even use the same webhook for IFTTT, but send information along with your post to determine if Donald or electric fence triggered it.
Here is some code I use to monitor some demo equipment.

if ()
url='https://maker.ifttt.com/trigger/TSTrigger/with/key/xxxxxxxxxxxxxxxxxxx';
webwrite(url,'value1','Weatherstation')
end

If the weatherstation goes down, my email will include the word weathersation. You can put 'Donald' or 'fence'. You may have to configure your IFTTT response to include this, but in my case it was included by default if you don't remove it.

March 7, 2019
10:44 am
Avatar
Nettlevodka
New Member
Members
Forum Posts: 3
Member Since:
March 3, 2019
sp_UserOfflineSmall Offline

Thanks to both of you... I haven't looked at MATLAB for anything yet... I guess I'd better open the envelope and see what's in side, sounds great!

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
22 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

briskpanda, Dejw0089, Yassine Ben Salah, anis, 43994554AKS, suda

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457