Yes, I think that I made the pull request, let me know if you still don’t see it
Hi Team, not sure what am I doing wrong but it is it isn’t working for me. I do receive the email but there is no way to get the variable value on the body of the received mail.
this is my Yun scketch
//#define _DEBUG_
#define _DISABLE_TLS_
#include <BridgeSSLClient.h>
#include <ThingerYun.h>
#define USERNAME "OldNerd"
#define DEVICE_ID "Yun"
#define DEVICE_CREDENTIAL "xxxxxxxx"
ThingerYun thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
int ValLitros;
void setup() {
//Serial.begin (115200);
pinMode(LED_BUILTIN, OUTPUT);
// initialize bridge
Bridge.begin();
thing["led"] << digitalPin(LED_BUILTIN);
thing["litros"] >> outputValue(ValLitros);
}
void loop()
{
ValLitros = random (300);
if (ValLitros > 250)
{
//thing.call_endpoint("EP1");
thing.call_endpoint("EP1",thing["litros"]);
}
thing.handle();
delay (10000);
}
i did tried the following options for the call
1 - thing.call_endpoint("EP1",thing["litros"]);
2 - thing.call_endpoint("EP1",thing["ValLitros"]);
with no joy…
on the EndPoint I have tried the following options
1 - Consumo llegó a un nível critico de {{ValLitros}} Litros
2 - "Consumo llegó a un nível critico de {{ValLitros}} Litros"
3 - Consumo llegó a un nível critico de {{litros}} Litros
4 - "Consumo llegó a un nível critico de {{litros}} Litros"
5 - Consumo llegó a un nível critico de {{}} Litros
6 - "Consumo llegó a un nível critico de {{}} Litros"
none of them worked. Please let me know what am I doing wrong.
Gracias!!!
I have not used the email end recently, I do not have it implemented now, but according to my publication, it should work with option 1 on the call and option 5 on the endpoint.
I recommend that you avoid the use delay function, this causes the abnormal behavior in the thinger platform, use another method to control the loop or functions frequency.
@ega many thanks for your reply. I followed your suggestions (including deleting the delay function) but unfortunately there was no progress. Mail is received but the data value (litros) arrives empty.
Any other suggestion? Do you know if there is a way to contact Thinger directly (i guess Alvaro is the owner/developer)
Cheers!
Hi, this is how my Email body looks like:
{{}}
and this is what I get (empty body)
Consumo en nível critico
Inbox
xno-reply@thinger.io via amazonses.com
3:30 PM (2 hours ago)
to me
Hi
I tried again the endpoint call with a “thing” with just one resource and email body as {{}} but it didnt work,
I tried with a “thing” with more than one resource, defined as the next
thing["Distance"] >> [](pson& out)
{
out["Feet"] = actualFeet;
out["Inches"] = actualInch;
};
The call is made by (asure that the call is made just one time by any way):
if(mail)
{
thing.call_endpoint("endpoint_id",thing["Distance"]);
mail=0;
}
The mail body:
The actual distance is {{Feet}} feet and {{Inches}} inches.
And receive mail:
“The actual distance is 14 feet and 1 inches.”
Hope this helps,
Regards
Surely it is, maybe it was lost unintentionally in some platform update.
Is your issue solved? can you send emails with values in the device?
If you need just one resource you can define the “thing” as I shown you with just one resource, its not needed to have more than one using that definition method.
@ega I solved the issue using the hints given by @JorgeTrincado in the post below which is basically the same approach you suggested. Many thanks
https://community.thinger.io/t/smart-freezer-with-thinger-io-climastick/538/3
It should be fixed now! Now you can use {{}}
for sending values without keys. It is now even possible to add variables to the email subject
Best.
hi everyone,
I got a problem here. I use NodeMCU V2,previously i try any codes (without endpoint),there’s no error. But after i added an endpoint and can sent 1-2 emails, suddenly may device disconnected/offline. i think my internet connection, but i try browse any websites, no problem. Then i use another NodeMCU, there’s no changes. The last way,i made a new device id, and it works. After i try sent email,it happened again, my device id such like blocked,unused.
This my code :
#define EMAIL_ENDPOINT1 “pintu_1”
#define DOOR_PIN D1
#define WINDOW_PIN D2
#define DHTPIN D3
#define DHTTYPE DHT11
#define ALARM_PIN D4String door;
String window;
String kit;
float temp;ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
DHT dht(DHTPIN, DHTTYPE);
void setup() {
dht.begin();
pinMode(DOOR_PIN, INPUT);
pinMode(WINDOW_PIN, INPUT);
pinMode(DHTPIN, INPUT);
pinMode(ALARM_PIN, OUTPUT);thing[“pintu 1”] >>(pson& out){ out = (door); };
thing[“pintu 2”] >>(pson& out){ out = (window); };
thing[“dht11”] >> (pson& out){ out = temp; };
thing[“dapur”] >>(pson& out){ out = (kit); };
thing[“alarm”] <<(pson& in){
if(in.is_empty()){
in = (bool) digitalRead(ALARM_PIN);
}
else{
digitalWrite( ALARM_PIN, in ? HIGH : LOW);
}
};thing.add_wifi(SSID, SSID_PASSWORD);
}void loop() {
thing.handle();
int baca1 = digitalRead(DOOR_PIN);
int baca2 = digitalRead(WINDOW_PIN);//pembacaan sensor pada Pintu
if (baca1!=HIGH){
thing.call_endpoint(EMAIL_ENDPOINT1, “door”);
door = “Pintu 1 Terbuka!!!”;
}else{
door = “Aman.”;
}//pembacaan sensor pada Jendela
if (baca2!=HIGH){
window = “Pintu 2 Terbuka!!!”;
}else{
window = “Aman.”;
}//pembacaan sensor DHT11
float t = dht.readTemperature(); //Membaca suhu dalam satuan Celciustemp = t;
if (temp>40){
kit = “Dapur Kebakaran!!!”;
}else{
kit = “Aman.”;
}}
i got an email from no-reply@thinger.io. It said
Your device Tugas_Akhir has been disabled due to excessive call fails. This often happens when your device calls your resources (endpoints or buckets) at inappropriate rate. Please, verify your device code.
my question is : which real problem??
- my code,cause i use String data, not Value.
- my internet connection, cause i use wireless internet (wifi), so it’s not stable.
thanks for reply, sorry for my bad english.
Is your code, not by the variable kind you are using, is the rate that the endpoint is called.
Is important to made the call just one time, by your code you are calling it at the speed that the microcontroller can when the condition “baca1!=HIGH” is present… Thats why the device become blocked
You need to limit the frequency with which you call the endpoint, I think I read it somewhere (I do not remember the specific amount of time should be waited between calls), but totally sure you are breaking it as how is the endpoint called.
so the problem is the code??i must set the limit frequency for calling the endpoint,could you remember the link you mean??i need it so much,i’m newbie here,
but its no connection with the widget at dashboard,right? cause i set the refresh rate for that widget by sampling for every 1 second,
You must set the frequency in code, there is no field to establish this, the link doesn’t says how to do it.
I don’t know if you understand how the microcontroler works, in the example that you posted, when the condition “baca1!=HIGH” is true, and the microcontroler can run this routine more than 10k times in one second…
You should asure by any method that it run just one time, I use a flag for this as this example:
if (baca1!=HIGH && mailFlag)
{
thing.call_endpoint(EMAIL_ENDPOINT1, “door”);
door = “Pintu 1 Terbuka!!!”;
mailFlag=0;
}
And you should set the “mailFlag” again somewhere else in the code, I dont know your process and have no idea where is appropiate to do it.
Hope this helps
okay,i’ll try that one.
thank you very much.
i’m confused,i have no idea. Just like what u said, i need to find a method so it run just one time. I just using flag which you exemplify before. And it same,my device id still blocked,although i receive that notification emails. Have you any other ideas @ega ??
The device is becoming blocked because you are seting the “mailFlag” again in the wrong place, the routine I gave you will run just one time as max, and it is running the “if” with the call to endpoint routine several times.
You need to establish where is the best place to set this flag again, I recommend to do it in another natural routine of the process, in the code.