Ifttt and Google assistant botton push

Hi I have configured the project to run ifttt with Google assistant, with the switch button [“1”] [“0”] it works, but I would like to use it for a push button know in the body that string should I use?

I do this with the code. Basically the pin is set HIGH (or LOW depending on needs) using IFTTT and Google Assistant, and is then set beck to its original state using a timer.

timer.setTimeout(500L, []() {  // Run after .5 seconds second
    Blynk.virtualWrite(V0, LOW);  // Set Virtual Pin 0 LOW
  });  // END Timer Function
2 Likes

This is that you wrote me you go in the code of the NodeMcu, I want the one of the body of the applet of ifttt

Just showing you how I do it.

I do not know of a way to do it with the applet of IFTTT. From my research this is the easiest way to accomplish this task.

Hello,

Are you trying to get a push-button work as a switch, in addition of Blynk app and IFTTT control. The best implementation i have seen is from @chrome1000

I guess I am not clear on this issue. If what you want is a push-button style effect, I am not sure why the suggestion from @Toro_Blanco is not acceptable. If you want to keep [0] and [1] for ON/ OFF, in addition to push-buttong effect just use any other variable [3] (again, take cues form @chrome1000’s code where he uses 2 for toggling.

This is perfectly fine.

@Toro_Blanco: Do you know what the L in 500L is for?

Long… and in long() data type.

So, the timer takes a integral input, right? as in milliseconds?

Why long? Are there situations that it is needed over just 500?

Yes. But honestly, I don’t even know if the L is required… the time is designated as a long d, but the L is missing in all the official library examples (BlynkTimer is based off of SimpleTimer). It might just be assumed to be a long()

EDIT - according to what I interpret in the library, any number is taken as an unsigned long… so the added L is unnecessary.

https://playground.arduino.cc/Code/SimpleTimer#Functions

Why not?? I didn’t write the library :wink: but I don’t see why one wouldn’t have a timer that runs hours or more (theoretically up to just over 24.8 days), all without needing any RTC or interrupts. Just depends on your needs.

Gotcha - forgot that if not long, the simple input is limited in time.

So the only solution is to set in the code that the button must be arrive for example 500ms and then return to the original position?

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.

1 Like

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?

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.

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

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)

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:

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:

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.

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