Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed IFTTT connection issue, thanks for the tip! #19

Open
twingall1 opened this issue Jul 9, 2022 · 0 comments
Open

Fixed IFTTT connection issue, thanks for the tip! #19

twingall1 opened this issue Jul 9, 2022 · 0 comments

Comments

@twingall1
Copy link

twingall1 commented Jul 9, 2022

followed your link and found some code which fixed the IFTTT section of the code so it now works for me; sends both email and phone notifications.
Thanks for the tip
here is the latter part of the .ino code with my edit:

.....
    cpm = (60000 * counts) / (millis() - startCountTime) ;
    counts = 0 ;
    startCountTime = millis() ;
    lastCountTime += PERIOD_LOG * 1000;
    display.clear();
    displayString("Radioactivity", 64, 0);
    displayInt(cpm, 64, 30);
    if (cpm >= 200) {
      if (active) {
        active = 0 ;
        display.clear();
        displayString("¡¡ALARM!!", 64, 0);
        displayInt(cpm, 64, 30);
//////////////////////////////////////////////////////////////////   
//begin edit---     
              //Send email
        int    HTTP_PORT   = 80;
        String HTTP_METHOD = "POST"; // or "GET"
        char   HOST_NAME[] = "maker.ifttt.com"; // hostname of web server:
        String PATH_NAME   = "/trigger/radiationHigh/json/with/key/kBhwl8us_6dBBeL"; //(not a real API key; add your own here, after key/   ... change 'radiationHigh' to whatever is your 'event' name in IFTTT
          if(client.connect(HOST_NAME, HTTP_PORT)) {
            Serial.println("Connected to server");
          } else {
            Serial.println("connection failed");
          }
          // send HTTP request header
          client.println(HTTP_METHOD + " " + PATH_NAME + " HTTP/1.1");
          client.println("Host: " + String(HOST_NAME));
          client.println("Connection: close");
          client.println(); // end HTTP request header
          
//comment out the following 3 lines...          
//#ifdef IFTT
//        IFTTT(cpm);
//#endif

//end edit---
//////////////////////////////////////////////////////////////////
      } ;
    }
    else if (cpm < 100)
    {
      active = 1 ;
    } ;
#ifdef CONS
    Serial.print("cpm: "); Serial.println(cpm);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant