Mandare email con Temboo - Gmail - Yùn

Ciao a tutti, e buon anno!

Vorrei poter mandare una mail riportando i valori dei miei sensori.
Per il momento riesco a mandare la mail ma non capisco come dirli di mandare il valore dei sensori?
Per ora mi manda solamente quello che scrivo in "SendEmailChoreo.addInput"

Il mio sketch è

#include <DHT.h>                           //For DHT22 & AM2302 library
#include <OneWire.h>                       //For DS18B20
#include <LiquidCrystal.h>
#include <Bridge.h>
#include <HttpClient.h>

//**********************GMAIL****************************************************\\
#include <Temboo.h>
#define TEMBOO_ACCOUNT "aaaaaa"          // your Temboo account name \
#define TEMBOO_APP_KEY_NAME "myFirstApp"  // your Temboo app key name\
#define TEMBOO_APP_KEY  "aaaaaaaaaa"  // your Temboo app key}
const String GMAIL_USER_NAME = "aaaaaaaaa@gmail.com";
const String GMAIL_PASSWORD = "aaaaaaaaa";
const String TO_EMAIL_ADDRESS = "aaaaaaaa@gmail.com";
boolean success = false;                 // a flag to indicate whether we've sent the email yet or not
//*******************************************************************************\\

#define DHTPIN 3                           //DHT22
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
float h = 0;
float t = 0;

const byte DS18B20_Pin = 4;                //DS18B20 Signal pin on digital 4
OneWire ds(DS18B20_Pin);                   // on digital pin 4

int Calc;                                  //Sensore flusso
volatile int NbTopsFan;                    //measuring the rising edges of the signal
int hallsensor;                            //The pin location of the sensor is 2 (int0 on Yun = Pin 2)
void rpm ()                                //This is the function that the interupt calls 
{ 
  NbTopsFan++;                             //This function measures the rising and falling 
                                           //edge of the hall effect sensors signal
} 

unsigned long ora = 0;
unsigned long ultimaEsecuzione = 0;
long intervalloEsecuzione = 10000;

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);


void setup()
{  
  pinMode(6, OUTPUT);                      //LED ROSSO ds18b20
  
  // ***For Flow sensor*****************************************
  pinMode(hallsensor, INPUT);              //initializes digital pin 2 as an input
  attachInterrupt(1, rpm, RISING);         //and the interrupt is attached
  // ***********************************************************
  
  // Bridge takes about two seconds to start up
  // it can be helpful to use the on-board LED
  // as an indicator for when it has initialized
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  Bridge.begin();
  
  Serial.begin(9600); 
  lcd.begin(16, 2);
  dht.begin();                             //DHT22
  
  //while (!Serial); // wait for a serial connection

 }

void loop()
{
 ora = millis();
  
dht22();
ds18b20();
//flusso();
gmail();
//emoncms();
//emoncms_async();

//delay(1000);                              //just to slow down the output it's easier to read

}
void gmail()
{
  // only try to send the email if we haven't already sent it successfully
  if (!success) {

    Serial.println("Running SendAnEmail...");

    TembooChoreo SendEmailChoreo;

    // invoke the Temboo client
    // NOTE that the client must be reinvoked, and repopulated with
    // appropriate arguments, each time its run() method is called.
    SendEmailChoreo.begin();

    // set Temboo account credentials
    SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT);
    SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
    SendEmailChoreo.setAppKey(TEMBOO_APP_KEY);

    // identify the Temboo Library choreo to run (Google > Gmail > SendEmail)
    SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail");

    // set the required choreo inputs
    // see https://www.temboo.com/library/Library/Google/Gmail/SendEmail/ 
    // for complete details about the inputs for this Choreo

    // the first input is your Gmail email address
    SendEmailChoreo.addInput("Username", GMAIL_USER_NAME);
    // next is your Gmail password.
    SendEmailChoreo.addInput("Password", GMAIL_PASSWORD);
    // who to send the email to
    SendEmailChoreo.addInput("ToAddress", TO_EMAIL_ADDRESS);
    // then a subject line
    SendEmailChoreo.addInput("Subject", "Stato");

     // next comes the message body, the main content of the email   
    SendEmailChoreo.addInput("MessageBody", "Ciao, come va oggi");

    // tell the Choreo to run and wait for the results. The 
    // return code (returnCode) will tell us whether the Temboo client 
    // was able to send our request to the Temboo servers
    unsigned int returnCode = SendEmailChoreo.run();

    // a return code of zero (0) means everything worked
    if (returnCode == 0) {
        Serial.println("Success! Email sent!");
        success = true;
    } else {
      // a non-zero return code means there was an error
      // read and print the error message
      while (SendEmailChoreo.available()) {
        char c = SendEmailChoreo.read();
        Serial.print(c);
      }
    } 
    SendEmailChoreo.close();

    // do nothing for the next 60 seconds
    delay(60000);
  }
}

Uso temboo perché ho trovato uno sketch che mi sembrava alla mia portata allora ho provato.
Funziona, la mail esce, ma non capisco come mandare i dati dei sensori?

Il prossimo passo per me sarà di fare in modo che quando io mando una mail alla Yùn, lei mi risponde con i valori dei sensori collegati ad essa...
Devo solo capire come fare ancora.

...Sono un noob.....

Non ho mai lavorato con queste cose, ma ipotizzo che tu possa fare:

SendEmailChoreo.addInput("MessageBody", "Ciao, come va oggi\n");
SendEmailChoreo.addInput("MessageBody", "Sensore 1: ");
SendEmailChoreo.addInput("MessageBody", variabileSensore1);
SendEmailChoreo.addInput("MessageBody", "\nSensore 2:");
SendEmailChoreo.addInput("MessageBody", variabileSensore2);

// E così via...

Prova così, magari funziona

Ho combinato!
Adesso la mia scheda mi manda i valori che voglio per email!! :smiley: Che figata!!

Se qualcuno sa dirmi come fare per farsi che la scheda mi mandi la mail con i valori quando le mando una mail io sarebbe ottimo perché per ora manda la mail quando carico lo sketch.

void gmail()
{
  // compose email content into a String called "emailContent"
  String emailContent("Ciao, come andiamo?. La temperatura attuale dell'acqua e' : ");
  emailContent += temperature;
  emailContent += "c. La temperatura in casa e' di : ";
  emailContent += t;  
  emailContent += "c. L'umidita' e' di : ";
  emailContent += h;
  emailContent += "%.";
  emailContent +=  " A presto!";
  
  // only try to send the email if we haven't already sent it successfully
  if (!success) {

    Serial.println("Running SendAnEmail...");

    TembooChoreo SendEmailChoreo;

    // invoke the Temboo client
    // NOTE that the client must be reinvoked, and repopulated with
    // appropriate arguments, each time its run() method is called.
    SendEmailChoreo.begin();

    // set Temboo account credentials
    SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT);
    SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
    SendEmailChoreo.setAppKey(TEMBOO_APP_KEY);

    // identify the Temboo Library choreo to run (Google > Gmail > SendEmail)
    SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail");

    // set the required choreo inputs
    // see https://www.temboo.com/library/Library/Google/Gmail/SendEmail/ 
    // for complete details about the inputs for this Choreo

    // the first input is your Gmail email address
    SendEmailChoreo.addInput("Username", GMAIL_USER_NAME);
    // next is your Gmail password.
    SendEmailChoreo.addInput("Password", GMAIL_PASSWORD);
    // who to send the email to
    SendEmailChoreo.addInput("ToAddress", TO_EMAIL_ADDRESS);
    // then a subject line
    SendEmailChoreo.addInput("Subject", "Stato");

     // next comes the message body, the main content of the email  
     SendEmailChoreo.addInput("MessageBody", emailContent); // and here we send the emailContent string
    //SendEmailChoreo.addInput("MessageBody", "Ciao, e' successo qualcosa ma ora e' tutto a posto.");

    // tell the Choreo to run and wait for the results. The 
    // return code (returnCode) will tell us whether the Temboo client 
    // was able to send our request to the Temboo servers
    unsigned int returnCode = SendEmailChoreo.run();

    // a return code of zero (0) means everything worked
    if (returnCode == 0) {
        Serial.println("Success! Email sent!");
        success = true;
    } else {
      // a non-zero return code means there was an error
      // read and print the error message
      while (SendEmailChoreo.available()) {
        char c = SendEmailChoreo.read();
        Serial.print(c);
      }
    } 
    SendEmailChoreo.close();

    // do nothing for the next 60 seconds
    //delay(60000);
  }
}

Hi there, I work for Temboo.

You can try receiving emails using the Gmail GetUnreadEmail Choreo here:

You can also send a text to a free Twilio account and have your Yún send an email when it receives a text. You can find the Choreo to receive texts here:

Hopefully this helps, but feel free to contact us via email (support AT temboo.com) if you have further questions - we're always happy to help.

Ciao
Ho un problema che non riesco a risolvere.
Qualcuno può darmi una mano ?

Non riesco a configurare lo sketch di temboo: dopo la configurazione della verifica a due step, dopo aver generato la password e inseriti i dati (l'indirizzo mail per esteso : xxx@gmail.com) dopo il 'Run' continua a segnalarmi : o non configurato verifica a due step ( riverificato e ok) oppure password sbagliata ( riverificato e ok) oppure indirizzo @ sbagliato ( riverificato e ok).

Qualcuno ha avuto e risolto questo problema ?
Ciao e grazie
Nando