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

Help with Webhooks and blynk

Hi. I’m trying to send a “variable” value(if its possible) to my blynk with webhooks, but I can only find information about sending a specific value to my blynk/hardware.

The goal is to make my own electric roller blinds and control them via Google assistant. For now, I can make them go either 100% up or 100% down, but I would like to say to my Google assistant: “set blinds to 48%” without making a webhook for every %step.

I currently use this to update my V6 widget:

Is this possible?
I’m using ESP8266

A “variable” value can be sent via webhooks by the simple process of re-sending the value each time it changes.

But in your case, both the transmitting and end result logic will probably need to be coded to account for simple preset phrases for each percentage of closure… “Open”, “Close”, “Half”, “Three quarters”, or “Position 1…2…3…”, etc.

Unless Google assistant is proficient enough to accurately discern your spoken percentage value into a stable integer value (the how-to is well outside of this forums purpose)… In which case your receiving Blynk code would simply take that integer and adjust the blinds accordingly… probably requiring some accurate way of measuring the mechanical distance traveled.

I think this is really an IFTTT question. You need to be able to get IFTTT to get the value from Google and pass it to the Webhook.

I don’t know if this is possible within IFTTT, but I’d be surprised if it isn’t.

Having said that, I’m not a great fan of IFTTT. Have you connidered looking at Sinric for your Google integration? There have been a few recent posts about this on the forum.

Pete.

Thank you!
Seems like I should read some more on the IFTTT part.
Haven’t heard about Sinric, but I will check it out!

all the options are okay for ifttt but the last option of your body optional is wrong just follow for the step for ON its
[“1”]
and for off
[“0”]
i’ve used it best of luck if any issue pls reply

in IFTTT select the Google assistant trigger part “Say a phrase with a number”

Then in the web hook, insert the number with # as the desired value.

Only one IFTTT applet needed. Set any percentage.

This turned out to be more of an IFTTT problem, but of course, I should use the "say a phrase with a number. I did this but my Blynk only returns “0”. My setup is now this for IFTTT:

My google assistant reads “Ok, setting blinds to 50%” but my ESP writes “0”.

my code for this section:

BLYNK_WRITE(V4)  // only for testing webhook
{
int test_nr = param.asInt();
Serial.print("nr from webhooks is =  ");
Serial.println(test_nr);  
}

Serial:

19:50:08.637 -> nr from webhooks is =  0

Is the Assistant sending an integer 50 or float 0.5? You code is assuming integer only

When i say: “set blinds to 50 percent” my google assistant writes/reads my words as: “set blinds to 50%”, so I would think its an integer.

Since the “%” sign could mess things up, I changed to “set blinds to 50”, without the “percent” and still nothing.

When I copy the URL into my browser and add “?value=5” it works perfectly, so the issue must be from the IFTTT, I don’t know which data type it sends.

Strange thing is that it responded earlier this day, but not the right value was feed through. I did not print this value but I could see that it was wrong as my motors rotated longer than the interval I said to my assistant. ie I said “turn blinds to 5 %” but my motors went far more than this.
That’s why I started printing the value, and suddenly blynk only received “0” for all values.

You code is set to only interpret integers… try other options until you know exactly what you are receiving.

http://docs.blynk.cc/#blynk-firmware-virtual-pins-control

Ok, thanks! I’ll try

trigger phrase is “set blinds to”

you say: “set blinds to 50”

it passes 50 to the HTTP call.
Use HTTP GET its easier.

It does not work at all with GET. Only PUT works for me/ my setup.

It is using HTTP GET

Make the trigger phrase

“Set blinds to #”

Try GET URL:

http://blynk-cloud.com/auth_token/update/V4?value=<<#>>
or
http://blynk-cloud.com/auth_token/update/V4?value=#

(cant recall which is correct)

I figured it out. I had to use the “add ingredient” field and select {{Numberfield}} :slight_smile: All god, tank you!

2 Likes

hi sh_89 i also are trying to do my window blinds with esp8266 with alexa, ive found your IFTTT + webhooks code and tried it, but cant get it to work i was to be able to say “alexa set blinds to 30%” instead of this low,medium,high state. any help please??

You must use the google assistant “say a number and a phrase” instead of “say a phrase”. If you change this in the IFTTT it works.