BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Ifttt and Google assistant botton push


#12

It is the ONLY solution discussed here, and suggested by the limited number of people responding to this post. To say it is the ONLY solution may be a bit of an assumption. What have you discovered in your research from when you opened this topic approx. 8 days ago? Or were you just waiting for someone to find it for you?

What is presented above is how I do it, and the ONLY way I have seen. I would suspect that there is another way of doing it using the Google Assistant Tools, but from the little I have looked into that, it looks a lot more complicated than a few lines of code.


#13

Honestly, I have not had the chance to rehearse. I was looking for a different solution than the code because where the device is located is inconvenient to work on it. If this is the only road I’ll try it even if I was hoping for something simpler. My question is this once I put this function will remain that even if I use the app or switch button. Quite right?


#14

As I mentioned, this is the only solution the I know of. It is very possible that there are other ways of doing it.

One plus to pulling the board out and updating the code is that you can now also add OTA updating. OTA This will make future improvements to your device so much easier.

As to if the function will remain the same, I do not know as, I do not know how your current code functions. If you would like to post your code (properly formatted that is), I may be able to look it over and see what the effect may be.


#15

The OTA solution could be a good solution, some examples to understand how it works?


#16

Examples and documentation is in the DOCS.

Do note that it appears that OTA needs a Local Server set-up. (I currently don’t use it)


#17

This forum has a great search function… the magnifying glass icon at the top.

Should pull up lots of OTA topics, like this on :stuck_out_tongue_winking_eye:


#18

No it does not!! Basic OTA will work right from the IDE… in fact the basic OTA has nothing to do with Blynk or it’s servers at all.

Advanced OTA can make use of a Web server, but… that is the advanced side :wink:


#19

Awesome, good to know. I was going off the opening statement for OTA from the DOCS :
OTA DOCS

Blynk also supports over the air updates for - ESP8266, NodeMCU and SparkFun Blynk boards. OTA supported only for the private servers and for the paid customers for now.


#20

That’s right, I forgot there was some Blynk oriented OTA option… but as you say, that is geared for Production Apps.

The OTA I am referring to is Arduino OTA - from the Arduino Core for ESP


#21
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
SimpleTimer timer;

char auth[] = "xxxxxxxxxxxxxxxxxxx";
 
char ssid[] = "xxxxxxxxxxxxx";
char pass[] = "xxxxxxxxxxxx";
 
void setup() {
  Serial.begin(115200);


  pinMode(4, OUTPUT); //D2 is GPIO 4 (POMPA ANTICONDENZA IN4) (RELAY SWITCH)
  digitalWrite(4, HIGH); // Set GPIO 4 HIGH

  
  pinMode(13, OUTPUT); //D7 is GPIO 13 (Cancello Grande RELE IN1)(RELAY BUTTON)
  digitalWrite(13, HIGH); // Set GPIO 13 HIGH
  timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
    digitalWrite(13, HIGH);  // Set  Pin 13 HIGH
  });  // END Timer Function

  pinMode(14, OUTPUT); //D5 is GPIO 14 (Cancello Piccolo RELE IN2)(RELAY BUTTON)
  digitalWrite(14, HIGH); //Set GPIO 14 HIGH
  timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
    digitalWrite(14, HIGH);  // Set  Pin 14 HIGH
  });  // END Timer Function
  
  pinMode(5, OUTPUT); //D1 is GPIO 5 (Relay ACS RELE IN3)(RELAY BUTTON)
  digitalWrite(5, HIGH); //Set GPIO 5 HIGH
  timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
    digitalWrite(5, HIGH);  // Set  Pin 5 HIGH
  });  // END Timer Function

  
 Blynk.begin(auth, ssid, pass);
  
}
 
void loop() {
  Blynk.run();
}

this is the code all buttons only the relay 4 is a switch.

Can it work like this?


#22

It does not work, where am I wrong?


#23

You have all of your code in your setup. You will need to utilize BLYNK_WRITE(Vpin) and use virtual pins. In the IFTTT applet you will need to manipulate the virtual pin.

Here is an example, it should be placed before/outside of your setup(). You will need one of these for each relay/pin. Assuming relays are active HIGH
Use this URL in the applet (with your token inserted): http://blynk-cloud.com/auth_token/update/V0?value=1

BLYNK_WRITE(V0)
{   
  int value = param.asInt(); // Get value as integer
  
  if (value == 1)
  {
     digitalWrite(13, HIGH); // Set GPIO 13 HIGH
     timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
          digitalWrite(13, LOW);  // Set  Pin 13 LOW
           });  // END Timer Function

}

#24
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
SimpleTimer timer;

char auth[] = "XXXXXXXXXXXXXXXXX"; //nodemcu test
 
char ssid[] = "XXXXXXXX";
char pass[] = "XXXXXXXXXXX";

BLYNK_WRITE(V0)
{   
  int value = param.asInt(); // Get value as integer
  
  if (value == 1)
  {
     digitalWrite(13, HIGH); // Set GPIO 13 HIGH
     timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
          digitalWrite(13, LOW);  // Set  Pin 13 LOW
           });  // END Timer Function

}
}

BLYNK_WRITE(V1)
{   
  int value = param.asInt(); // Get value as integer
  
  if (value == 1)
  {
     digitalWrite(14, HIGH); // Set GPIO 13 HIGH
     timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
          digitalWrite(14, LOW);  // Set  Pin 13 LOW
           });  // END Timer Function

}
}

BLYNK_WRITE(V2)
{   
  int value = param.asInt(); // Get value as integer
  
  if (value == 1)
  {
     digitalWrite(5, HIGH); // Set GPIO 13 HIGH
     timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
          digitalWrite(5, LOW);  // Set  Pin 13 LOW
           });  // END Timer Function

}
}


void setup() {
  Serial.begin(115200);


  pinMode(4, OUTPUT); //D2 is GPIO 4 (POMPA ANTICONDENZA IN4) (RELAY SWITCH)
  digitalWrite(4, HIGH); // Set GPIO 4 HIGH

  
  pinMode(13, OUTPUT); //D7 is GPIO 13 (Cancello Grande RELE IN1)(RELAY BUTTON)
  digitalWrite(13, HIGH); // Set GPIO 13 HIGH
  
  pinMode(14, OUTPUT); //D5 is GPIO 14 (Cancello Piccolo RELE IN2)(RELAY BUTTON)
  digitalWrite(14, HIGH); //Set GPIO 14 HIGH
 
  
  pinMode(5, OUTPUT); //D1 is GPIO 5 (Relay ACS RELE IN3)(RELAY BUTTON)
  digitalWrite(5, HIGH); //Set GPIO 5 HIGH
  

  
 Blynk.begin(auth, ssid, pass);
  

} 
void loop() {
  Blynk.run();
}

I hope I have understood and written correctly?

For the speech, HIGH or LOW I to “standby” I have to put HIGH otherwise I will start the relay alone


#25

seems correct. Although I am a little confused by your last statement.

Are you relays active LOW or active HIGH?

As you set them HIGH in the setup it makes me think they are active LOW. If they are active LOW, you will need to change the logic around in the BLYNK_WRITE functions.

Example:

BLYNK_WRITE(V0)
{   
  int value = param.asInt(); // Get value as integer
  
  if (value == 1)
  {
     digitalWrite(13, LOW); // Set GPIO 13 LOW
     timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
          digitalWrite(13, HIGH);  // Set  Pin 13 HIGH
           });  // END Timer Function

}
}

#26

does not work,
the ifttt parameters are as follows

Make a web request
http://139.59.206.133/xxxxxxxxxxxxxxx/update/V0?value=1

Method
PUT

Content Type (optional)
application / json

for the HIGH or LOW speech
if I put in the LOW setup the relays start when I give the power to the circuit while if I put HIGH the relays start on command


#27

Well seems like you got it from here. Happy BLYNKing!!


#28

I do not understand what you mean


#29

You have the IFTTT stuff, and the code for your hardware. Was there something else giving you trouble, or is it still not working correctly.

If still not working, post latest code and describe your issue.


#30

Actually, it looks as if I missed something. See below, make sure all of the BLYNK_WRITE functions get this update. Again Assuming relays are active LOW

BLYNK_WRITE(V0)
{   
  int value = param.asInt(); // Get value as integer
  
  if (value == 1)
  {
     digitalWrite(13, LOW); // Set GPIO 13 LOW
     timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
          digitalWrite(13, HIGH);  // Set  Pin 13 HIGH
          Blynk.virtualWrite(V0, LOW);// Set  Virtual Pin 0 LOW
           });  // END Timer Function

}
}

#31
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
SimpleTimer timer;

char auth[] = "bca78xxxxx"; //nodemcu test
 
char ssid[] = "xxxxx";
char pass[] = "xxxxx";

BLYNK_WRITE(V0)
{   
  int value = param.asInt(); // Get value as integer
  
  if (value == 1)
  {
     digitalWrite(13, LOW); // Set GPIO 13 HIGH
     timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
          digitalWrite(13, HIGH);  // Set  Pin 13 LOW
          Blynk.virtualWrite(V0, LOW);// Set  Virtual Pin 0 LOW
           });  // END Timer Function

}
}

BLYNK_WRITE(V1)
{   
  int value = param.asInt(); // Get value as integer
  
  if (value == 1)
  {
     digitalWrite(14, HIGH); // Set GPIO 13 HIGH
     timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
          digitalWrite(14, LOW);  // Set  Pin 13 LOW
           });  // END Timer Function

}
}

BLYNK_WRITE(V2)
{   
  int value = param.asInt(); // Get value as integer
  
  if (value == 1)
  {
     digitalWrite(5, HIGH); // Set GPIO 13 HIGH
     timer.setTimeout(500L, []() {  // Run after 0.5 seconds second
          digitalWrite(5, LOW);  // Set  Pin 13 LOW
           });  // END Timer Function

}
}


void setup() {
  Serial.begin(115200);


  pinMode(4, OUTPUT); //D2 is GPIO 4 (POMPA ANTICONDENZA IN4) (RELAY SWITCH)
  digitalWrite(4, HIGH); // Set GPIO 4 HIGH

  
  pinMode(13, OUTPUT); //D7 is GPIO 13 (Cancello Grande RELE IN1)(RELAY BUTTON)
  digitalWrite(13, HIGH); // Set GPIO 13 HIGH
  
  pinMode(14, OUTPUT); //D5 is GPIO 14 (Cancello Piccolo RELE IN2)(RELAY BUTTON)
  digitalWrite(14, HIGH); //Set GPIO 14 HIGH
 
  
  pinMode(5, OUTPUT); //D1 is GPIO 5 (Relay ACS RELE IN3)(RELAY BUTTON)
  digitalWrite(5, HIGH); //Set GPIO 5 HIGH
  

  
 Blynk.begin(auth, ssid, pass);
  

} 
void loop() {
  Blynk.run();
}

this is the last code I wrote in practice with ifttt does not work. if you have already done so you can indicate the values of ifttt so I will verify them at least that we put them safe

PS. I focused only on the V0 then fix the others