March 3, 2019
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!
March 7, 2017
March 3, 2019
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!
May 1, 2016
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 7, 2017
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 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.
Most Users Ever Online: 166
Currently Browsing this Page:
Guest Posters: 1
Newest Members:huldacormier, bogart, estebanmateo93, mikewrite, onlinebusiness, winzy99
Moderators: cstapels: 460
Administrators: Hans: 405, lee: 457