I got a weird bug with the time input widget.
When I input a start and end time with my iPhone I got the values on my esp but the widget only shows —:—:—. When looking on a android phone I can see the time. Otherwise versa, inputting a time on android only shows the time on the esp and iphone.
Both apps run the latest versions.
On the android I got a „OK“ button on the top right, on the iPhone there is only a cancel button on the top left.
I don’t know if there is a problem with my sketch, I can upload it later. But it seems to be a bug since I am able to see the time on the other device.
Im sorry its a bit confusing. It ist hard for me to describe my problem in English.
In the first Picture you can see the IPhone setting a start and stop time.
As soon I press the cross in the top left the timer resets itself and shows —:—:— on the iPhone as you can see in picture two. On the Android phone it shows the set time as seen in picture three.
If i try it the other way around, setting the timer on the android phone as seen in picture four the timer reset itself on the android (picture 5) and shows the correct time at the iPhone (picture 6).
The arduino meanwhile gets the set time it doesn’t matter if i set it on the iPhone or android phone.
Maybe i misunderstand the input widget but i want to see what time i set it to.
When i log off the android phone i can’t see the time on my iPhone.
I receive the time on the arguing but can’t see anything on my iPhone.
Same thing when i only use arguing.
// 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 "#####"
#define BLYNK_AUTH_TOKEN "#####"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "#####";
char pass[] = "#####";
#define DHTPIN 2 // What digital pin we're connected to
#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
int startHour;
int startMinute;
int stopHour;
int stopMinute;
int Helligkeit;
String mystring;
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
WidgetRTC rtc;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V0, h);
Blynk.virtualWrite(V1, t);
}
BLYNK_WRITE(V2) //Helligkeit
{
Serial.print("Got a value: ");
Serial.println(param.asStr());
Helligkeit= (param.asInt());
}
BLYNK_WRITE(V3) //Lüfter
{
Serial.print("Got a value: ");
Serial.println(param.asStr());
}
BLYNK_WRITE(V5) {
TimeInputParam t(param);
if (t.hasStartTime()) {
startHour = t.getStartHour();
startMinute = t.getStartMinute();
}
if (t.hasStopTime()) {
stopHour = t.getStopHour();
stopMinute = t.getStopMinute();
}
Serial.print("Startzeit: ");
Serial.print(startHour);
Serial.print(":");
Serial.println(startMinute);
Serial.print("Endzeit: ");
Serial.print(stopHour);
Serial.print(":");
Serial.println(stopMinute);
}
BLYNK_CONNECTED() {
// Synchronize time on connection
rtc.begin();
}
void setup()
{
// Debug console
Serial.begin(57600);
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);
dht.begin();
setSyncInterval(10 * 60); // Sync interval in seconds (10 minutes)
// Setup a function to be called every second
timer.setInterval(1000L, sendSensor);
Blynk.syncVirtual(V5);
}
void loop()
{
Blynk.run();
timer.run();
}