Errror while sending 4 variables data to IFTTT. | ESP Wi-Fi | 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
Errror while sending 4 variables data to IFTTT.
No permission to create posts
July 10, 2019
7:08 am
Avatar
Aldric12
New Member
Members
Forum Posts: 3
Member Since:
June 28, 2019
sp_UserOfflineSmall Offline

Hi,
I am working on a machine vibration monitoring system and using a [ vibration sensor](https://store.ncd.io/product/iot-long-range-wireless-vibration-and-temperature-sensor/) and esp32. Three variables readings can be easily sent to IfTTT using Matlab analysis but can not send 4 variables values. Can you suggest to me how to send large variables values to IFTTT more than 3?
This code I am using :
channelID = 00000;

% Enter the trigger url from IFTTT. It will have the form:
%. https://www/maker/com/trigger//with/key/
iftttURL = 'xyz'
% Channel Read API Key (if you are using your own moisture channel)
% If your channel is private, then enter the read API Key between the '' below:
readAPIKey = 'BWSTOC0GDVNSJLLX';
% Calculate the threshold from the recent data.
thresholdTemp=25;
thresholdRms_x=25;
thresholdRms_y=15;
thresholdRms_z=86;

% Build the ThingSpeak URL.
thingSpeakURL = strcat('https://api.thingspeak.com/channels/',string(channelID),'/fields/1/last.txt');
thingSpeakURL1 = strcat('https://api.thingspeak.com/channels/',string(channelID),'/fields/2/last.txt');
thingSpeakURL2 = strcat('https://api.thingspeak.com/channels/',string(channelID),'/fields/3/last.txt');
thingSpeakURL3 = strcat('https://api.thingspeak.com/channels/',string(channelID),'/fields/4/last.txt');

% GET the data from ThingSpeak.
lastValue = str2double(webread(thingSpeakURL, 'api_key', readAPIKey));
lastValue1 = str2double(webread(thingSpeakURL1, 'api_key', readAPIKey));
lastValue2 = str2double(webread(thingSpeakURL2, 'api_key', readAPIKey));
lastValue3 = str2double(webread(thingSpeakURL3, 'api_key', readAPIKey));

if (lastValuethresholdTemp)
tempMessage = ' temperature is high ';
webwrite(iftttURL,'value1',lastValue,'value2', tempMessage);
end

if (lastValue1thresholdRms_x)
tempMessage = ' Rms_x is high ';
webwrite(iftttURL,'value3',lastValue1,'value4', tempMessage);
end

if (lastValue2thresholdRms_y)
tempMessage = ' Rms_y is high ';
webwrite(iftttURL,'value5',lastValue2,'value6', tempMessage);
end

if (lastValue3thresholdRms_z)
tempMessage = ' Rms_z is high ';
webwrite(iftttURL,'value7',lastValue3,'value8', tempMessage);
end

July 10, 2019
10:28 am
Avatar
cstapels
Moderator
Members


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

I would guess that IFTTT is blocking you if you try to send 4 messages with no delay in between them. I would recommend a few things.
1. Add some delay between each call to IFTTT, perhaps a second, but possibly more.
2. Consider sending the values in parallel instead of sequentially. You might have to reconsider how you deal with the trigger conditions.
for example webwrite(iftttURL,'value5',lastValue2,'value6', tempMessage, 'value7',myOtherValue, 'value8', yetAnotherValue);
etc.
You will also have to make changes to the app at ifttt to accept more values.
3. It would also be cool to add some delay in between your reads, just to not slam the ThingSpeak server

lastValue = str2double(webread(thingSpeakURL, 'api_key', readAPIKey));
delay(10);
lastValue1 = str2double(webread(thingSpeakURL1, 'api_key', readAPIKey));
delay(11);
lastValue2 = str2double(webread(thingSpeakURL2, 'api_key', readAPIKey));
delay(9);
lastValue3 = str2double(webread(thingSpeakURL3, 'api_key', readAPIKey));

4. You could write 2 or 4 separate MATLAB analysis and process some of the requests separately, so that they run asynchronously.
5. You could build a single string to send in your message.
Like this:
if condition1
String myValue=String(value1)
end
if condition2
myValue = myValue+ String(value2)
end
if condition3
myValue = myValue+ String(value3)
end
etc.
webwrite(iftttURL,'value7',myValue,'value8', tempMessage);

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
14 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:

dogarty, dlwiener, bulksms, bmchoice4u, irajames, YesItsMe

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457