No Datastreem to choice

Hi all

I’ve made my firt project: a simple led on/off. it works fine using the APP and console.
I just added a TIMER on the app (no available on console) but I can’t select the datastream because the app tell me to go to the device template and set up datastreams on the dashboard. But I have allready done it. So button has its one, and I can add a led and select the datastream and it works fine.

Why all the other objects can be connected with a datastream but TIMER doesn´t?

I use Iphone, esp8266 and last version of blynk 3.4.6
Thanks!

Sergi

First of all, there is no longer a Timer widget available in Blynk IoT, it has been replaced with Automations.

The widget that is available within Blynk IoT, and the one that I’m guessing you’ve selected is the Time Input widget. This is very similar to the Time Input widget that was available within Blynk Legacy, and which is much more complex to use (but is also much more powerful) compared to the old Legacy Timer widget.

The Time Input widget requires a virtual datastream with a String data type. The Start time, Stop time, days of the week selected and timezone offset are embedded within this string array, and need to be extracted and compared to the current time to decide whether or not to turn your device on or off.

I’d suggest that you take a look at Automations instead:

https://docs.blynk.io/en/concepts/automations

Pete.

Thank you very much Pete.
I thought that TIMER whas the same on old Blynk.
I’ll investigate Automations :slight_smile:

Sergi

As I said, there is no “Timer” widget in Blynk IoT, only “Time Input”.

Pete.

Yes Pete, I understood there is no Timer, sorry.

I have been investigating Automations. I could program an automation to “Swich Control” at a fixed time zone. And it works but ony when button is ON, then it turns OFF and my led do the same: turns off.
But if the led is off, at the time programmed on the Automation, the Swich Control does not change to ON. I do not understand why Swich Control ony works i one direction.

Can you help me?
Thanks!

Sergi

You need to provide more information about the automation you’ve created and the datastream that it’s attached to, along with the code you’re running on your device.

Pete.

Hello Pete.

Well I followed the steps creating the automation on the console. By now only 1 step trying to change the position of the button. If it is on, turn off. If it is off, turn on.
But only change if the button is ON.

My code is this and run well


  This is a simple demo of sending and receiving some data.

  Be sure to check out other examples!

 *************************************************************/

// Comment this out to disable prints and save space

#define BLYNK_PRINT Serial

// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud

// See the Device Info tab, or Template settings

#define BLYNK_TEMPLATE_ID "************"

#define BLYNK_DEVICE_NAME "Quickstart Template"

#define BLYNK_AUTH_TOKEN "*************"

#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>

char auth[] = BLYNK_AUTH_TOKEN;

char ssid[] = "***********";

char pass[] = "**********";

const int ledPin = 5; // 5 és el D1,

BlynkTimer timer;

void myTimerEvent()

{

  Blynk.virtualWrite(V2, millis()/1000);

  //Blynk.sendInternal("rtc", "sync"); //request current local time for device

}

// This function is called every time the Virtual Pin 0 state changes

BLYNK_WRITE(V0)

{

  // Set incoming value from pin V0 to a variable

  int value = param.asInt(); // Valor de l'interruptor1 ON 2 OFF

  Serial.print(value);

  if(value == 1) {

     // execute this code if the switch widget is now ON

     digitalWrite(ledPin,HIGH);  // Set digital pin 2 HIGH

  }

  if(value == 0) {

      // execute this code if the switch widget is now OFF

      digitalWrite(ledPin,LOW);  // Set digital pin 2 LOW    

    }

  // Update state

  Blynk.virtualWrite(V1, value);

}

// This function is called every time the device is connected to the Blynk.Cloud

BLYNK_CONNECTED()

{

  // Change Web Link Button message to "Congratulations!"

  Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");

  Blynk.setProperty(V3, "onImageUrl",  "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");

  Blynk.setProperty(V3, "url", "https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");

}

void setup()

{

  // Debug console

  Serial.begin(9600);

  pinMode (ledPin,OUTPUT);

  Blynk.begin(auth, ssid, pass);

  // You can also specify server:

  //Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);

  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Setup a function to be called every second

  timer.setInterval(1000L, myTimerEvent);

}

void loop()

{

  Blynk.run();

  timer.run();

  // You can inject your own code or combine it with other sketches.

  // Check other examples on how to communicate with Blynk. Remember to avoid delay() function!

}```

@SergiHH Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Pete.

Which datastream are you switching with the automation, and what min/max values have you specified?

Pete.

I did not change anything from the example (I think haha):

Only in automations I set ON on “action” as follow:

What values do you see in your serial monitor?

Pete.

I see 0 or 1 when I change the value on/off every time:

Pete, is possible to delete all and start again the QuickStart Template and the QuickStart Device? I mean, ask if Blynk can create again the QuickStart Template and Device.

Of course, just delete the template.

I’d strongly recommend that you don’t go down the QuickStart route.
Create the template, datastreams, device and sketch manually.

Pete.

ok Pete

Thanks!

You probably mean Time Input? Time Input requires String type datastream.

Hello Pete.

I could make my project working fine building it again. Now I have it installed on my whater heater, like I had with old Blynk.
Now I’m going to export to new Blynk my other project working with old blynk too: reading the electricity consumptions in my home… wish me luck! :slight_smile:
Thank you very much.
Sergi

1 Like