Alguém pode me ajudar, preciso saber se é possível controlar os botões virtuais do blynk através do Jarvis.

If you translate your post, you can get more help i guess

probably using Blynk REST API :wink:

Olá, Alexis.
Novamente você foi fantastico, agora só precisava saber como fazer para desligar e ligar varios botões ao mesmo tempo pelo exemplo que você me passou, fico grato pela sua ajuda.
1 Like

There is only one problem now, I need the value that the URL returns for Jarvis to recognize if it is off or on.

I think it’s the same as with alexia or google ? but I don’t know any more about Jarvis :thinking:

I guess it depends on the format of the data you are receiving. If it’s a very simple JSON string then parsing it should be simple.


Hi, Pete.
This is the code I am using, you can help me.

" tuff on Google so that you have the basic concepts of programming down.

Since this topic seems to be going in circles, here is your code. If it doesn’t work report back the error, and I’ll see what I can do to fix it(provided I am not busy).

Since I am not sure if you understand where this information is in the code; the name of the wifi network it will generate is Wifi_Manager, and the password is password.

#include <FS.h>                   //this needs to be first, or it all crashes and burns...

#include <ESP8266WiFi.h>          //https://github.com/esp8266/Arduino
#include <BlynkSimpleEsp8266.h>
//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>          //https://github.com/tzapu/WiFiManager
#include <SimpleTimer.h>
#include <ArduinoJson.h>          //https://github.com/bblanchon/ArduinoJson

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
//#define BLYNK_DEBUG

BlynkTimer timer;

//define your default values here, if there are different values in config.json, they are overwritten.
//char mqtt_server[40];
//char mqtt_port[6] = "8080";
char blynk_token[34] = "YOUR_BLYNK_TOKEN";

//flag for saving data
bool shouldSaveConfig = false;

int estadorele1 = LOW;
int estadorele2 = LOW;
int estadorele3 = LOW;
int estadobotao1 = HIGH;
int estadobotao2 = HIGH;
int estadobotao3 = HIGH;

//callback notifying us of the need to save config
void saveConfigCallback () {
  Serial.println("Should save config");
  shouldSaveConfig = true;


  estadorele1 = param.asInt();
  digitalWrite(4, estadorele1); 

void checkPhysicalButton1()
  if (digitalRead(12) == LOW)
    if(estadobotao1 != LOW)
      estadorele1 = !estadorele1;
      digitalWrite(4, estadorele1);
      Blynk.virtualWrite(V1, estadorele1);
    estadobotao1 = LOW;
    estadobotao1 = HIGH;

  estadorele2 = param.asInt();
  digitalWrite(5, estadorele2); 

void checkPhysicalButton2()
  if (digitalRead(13) == LOW)
    if(estadobotao2 != LOW)
      estadorele2 = !estadorele2;
      digitalWrite(5, estadorele2);
      Blynk.virtualWrite(V2, estadorele2);
    estadobotao2 = LOW;
    estadobotao2 = HIGH;

  estadorele3 = param.asInt();
  digitalWrite(16, estadorele3); 

void checkPhysicalButton3()
  if (digitalRead(14) == LOW)
    if(estadobotao3 != LOW)
      estadorele3 = !estadorele3;
      digitalWrite(16, estadorele3);
      Blynk.virtualWrite(V3, estadorele3);
    estadobotao3 = LOW;
    estadobotao3 = HIGH;

void setup() {
  // put your setup code here, to run once:

   pinMode(12, INPUT_PULLUP);
  pinMode(13, INPUT_PULLUP);
  pinMode(14, INPUT_PULLUP);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(16, OUTPUT);

  //clean FS, for testing

  //read configuration from FS json
  Serial.println("mounting FS...");

  if (SPIFFS.begin()) {
    Serial.println("mounted file system");
    if (SPIFFS.exists("/config.json")) {
      //file exists, reading and loading
      Serial.println("reading config file");
      File configFile = SPIFFS.open("/config.json", "r");
      if (configFile) {
        Serial.println("opened config file");
        size_t size = configFile.size();
        // Allocate a buffer to store contents of the file.
        std::unique_ptr<char[]> buf(new char[size]);

        configFile.readBytes(buf.get(), size);
        DynamicJsonBuffer jsonBuffer;
        JsonObject& json = jsonBuffer.parseObject(buf.get());
        if (json.success()) {
          Serial.println("\nparsed json");

          //strcpy(mqtt_server, json["mqtt_server"]);
          //strcpy(mqtt_port, json["mqtt_port"]);
          strcpy(blynk_token, json["blynk_token"]);

        } else {
          Serial.println("failed to load json config");
  } else {
    Serial.println("failed to mount FS");
  //end read

  // The extra parameters to be configured (can be either global or just in the setup)
  // After connecting, parameter.getValue() will get you the configured value
  // id/name placeholder/prompt default length
  //WiFiManagerParameter custom_mqtt_server("server", "mqtt server", mqtt_server, 40);
  //WiFiManagerParameter custom_mqtt_port("port", "mqtt port", mqtt_port, 6);
  WiFiManagerParameter custom_blynk_token("blynk", "blynk token", blynk_token, 33);

  //Local intialization. Once its business is done, there is no need to keep it around
  WiFiManager wifiManager;

  //set config save notify callback

  //set static ip
  //wifiManager.setSTAStaticIPConfig(IPAddress(10,0,1,99), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
  //add all your parameters here

  //reset settings - for testing

  //set minimu quality of signal so it ignores AP's under that quality
  //defaults to 8%
  //sets timeout until configuration portal gets turned off
  //useful to make it all retry or go to sleep
  //in seconds

  //fetches ssid and pass and tries to connect
  //if it does not connect it starts an access point with the specified name
  //here  "AutoConnectAP"
  //and goes into a blocking loop awaiting configuration
  if (!wifiManager.autoConnect("Wifi_Manager", "password")) {
    Serial.println("failed to connect and hit timeout");
    //reset and try again, or maybe put it to deep sleep

  //if you get here you have connected to the WiFi
  Serial.println("connected...yeey :)");

  //read updated parameters
  //strcpy(mqtt_server, custom_mqtt_server.getValue());
  //strcpy(mqtt_port, custom_mqtt_port.getValue());
  strcpy(blynk_token, custom_blynk_token.getValue());

  //save the custom parameters to FS
  if (shouldSaveConfig) {
    Serial.println("saving config");
    DynamicJsonBuffer jsonBuffer;
    JsonObject& json = jsonBuffer.createObject();
    //json["mqtt_server"] = mqtt_server;
    //json["mqtt_port"] = mqtt_port;
    json["blynk_token"] = blynk_token;

    File configFile = SPIFFS.open("/config.json", "w");
    if (!configFile) {
      Serial.println("failed to open config file for writing");

    //end save

  //Serial.println("local ip");

  bool result = Blynk.connect();

if (result != true)
  Serial.println("BLYNK Connection Fail");
  delay (5000);
  Serial.println("BLYNK Connected");
  timer.setInterval(100L, checkPhysicalButton1);
  timer.setInterval(113L, checkPhysicalButton2);
  timer.setInterval(122L, checkPhysicalButton3);

void loop() {
1 Like

I’ve removed your code, as it wasn’t correctly formatted with triple backticks.
For future reference, triple backticks look like this:

I wouldn’t bother re-posting your code, as it will be of no help in answering your original question.
What forum members do need to know in order to assist you is what the data returned by the Jarvis API call looks like.


1 Like

I need the GET value.

If you’re saying that you need to know how to make the Jervis GET API call then I think you’re asking in the wrong forum.

If you mean that you need to extract a piece of data from the JSON data that is returned when you make a GET API call to Jervis then you need to post what data is returned by the GET call.


As for Jarvis, no problem, he just needs a return value from GET.
For example:
If I type http://blynk-cloud.com/279dexxxxxxxxxxaafc/update/V1?value=1, I would need to return the value one and it doesn’t.
Jarvis works with http:

Just like when you create an onclick button, when you click on it, it returns 0 or 1 in the browser url on or off, depending on how the button was programmed.

If you read the documentation for the Blynk restful API then you’ll see the the value returned from a a GET update will be 200, 400 or 500 depending on whether or not the update was successful…

If you want to return the value of the virtual pin you need to do a straightforward get.

If the virtual pin value is 1 then the API will return [“1”]


This code of mine is not returning, you managed to see the code I sent you.



Understand that jarvis has nothing to do with Blynk. It’s HTTP Restfull. I’m using ESP 8266-12f, he must return the request directly via URL for Jarvis to recognize the request.


Understand that jarvis has nothing to do with Blynk. It’s HTTP Restfull. I’m using ESP 8266-12f, he must return the request directly via URL for Jarvis to recognize the request.

I’ve told you, you aren’t making a request with your Blynk API GET call, you’re doing an update. You need to use a different syntax and I’ve linked to the API documentation that you need to follow.