Timer widget problem on iPhone SE 64GB

Dear all, I’ve shared a project with a friend of mine related to a temperature monitor via DS18B20 probe. I have a problem with Timer Widget: in my smartphone (OS Android) it works properly and when the project is in “run” mode, is possible to tap in Timer widget and set start/stop time.

My friend (to whom I shared the project) have an iPhone SE 64GB (Version 11.4.1 - 15G77) and a iPad air2 64GB (Version 11.4.1 - 15G77) and in both devices, tapping on timer widget nothing, happen and is not possible to set start/stop time.

For now I’ve solved the problem from my side (Android OS) with Eventor Time Widget, but my pourpose is to make the other person able to set the timer by itself.

I’m using a Wemos D1 mini on Blynk server. Blynk Version 2.23.0 (4)

Hereafter the code.

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SimpleTimer.h>
#include <WidgetRTC.h>

// Data wire is plugged into port D5 on the Wemos
#define ONE_WIRE_BUS D5

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

char auth[] = "e45xxxxxxxxxxxxxxxxxxxxxxxxxxx8cff";
char ssid[] = "XXXXXX";
char pass[] = "XXXXXXXX";

float soglia;
int attivato;
bool flag_1 = LOW;
bool flag_2 = LOW;

BlynkTimer timer;
WidgetRTC rtc;
WidgetTerminal terminal(V55);

#define pin_assenza_rete D6

void setup() {
     Blynk.begin(auth, ssid, pass);
     Serial.begin(9600);
     // Start up the library
     
     sensors.begin();
     rtc.begin();
     
     pinMode(pin_assenza_rete, INPUT);

     timer.setInterval(2000L, inviaTemp);
     timer.setInterval(30000L, presenza_alimentazione);
     timer.setInterval(180000L, notifica);
     timer.setInterval(60000L, inviaOrario); //invia orario
}

// recupera tutti i valori dal server nel caso in cui WeMas si spenga o resetti
BLYNK_CONNECTED() {
Blynk.syncAll();
}

BLYNK_WRITE(V10) // Step Widget per impostare soglia allarme
{
  soglia = param.asFloat();
  Blynk.virtualWrite(V11, soglia);
}

BLYNK_WRITE(V3) // Timer Widget per impostare quando rendere attivo allarme
{
  attivato = param.asInt();
}

//=====================================================
  void inviaTemp()  
{ 
  // call sensors.requestTemperatures() to issue a global temperature request to all devices on the bus
  sensors.requestTemperatures(); // Send the command to get temperatures  
  
  // After we got the temperatures, we can print them here.
  
  Blynk.virtualWrite(V1, sensors.getTempCByIndex(0));
  Blynk.virtualWrite(V2, sensors.getTempCByIndex(0));


  if (attivato == HIGH)
{
  Blynk.setProperty(V15, "color", "#00DD00");
  Blynk.virtualWrite (V15, "Allarmi attivi");
}

else  {
  Blynk.setProperty(V15, "color", "#DD0000");
  Blynk.virtualWrite (V15, "Allarmi spenti");
  }

}

//=====================================================
void notifica()
{
  if (sensors.getTempCByIndex(0) > soglia && attivato == HIGH)
{
  Blynk.notify("Temperatura frigo alta!");
}
}

//=====================================================
void presenza_alimentazione()
{
  if (digitalRead(pin_assenza_rete) == HIGH)
{
  Blynk.setProperty(V12, "color", "#DD0000");
  Blynk.virtualWrite (V12, "Assenza alimentazione!");

  if (flag_1 == LOW)
  {
  String currentTime = String(hour()) + ":" + minute();  // + ":" + second();
  String currentDate = String(day()) + "-" + month() + "-" + year();
  terminal.print(currentDate);
  terminal.print(" ore ");
  terminal.print(currentTime);
  terminal.println(" Assenza 220V!");
  terminal.flush();
  flag_1 = HIGH;
  flag_2 = LOW;
  Serial.println(flag_1);
  }
    
//  if (attivato)
//  { 
//  Blynk.notify("Assenza alimentazione!");
//  }
}

else  {
  Blynk.setProperty(V12, "color", "#00DD00");
  Blynk.virtualWrite (V12, "Alimentazione OK");
  
  if (flag_2 == LOW)
  {
  String currentTime = String(hour()) + ":" + minute();  // + ":" + second();
  String currentDate = String(day()) + "-" + month() + "-" + year();
  terminal.print(currentDate);
  terminal.print(" ore ");
  terminal.print(currentTime);
  terminal.println(" 220V presente");
  terminal.flush();
  flag_2 = HIGH;
  flag_1 = LOW;
  Serial.println(flag_2);
  }
     }
}

//=====================================================
void inviaOrario()
{
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details

  String currentTime = String(hour()) + ":" + minute();  // + ":" + second();
  String currentDate = String(day()) + "-" + month() + "-" + year();
  String tempoRozzo =  String(hour()) + minute();
  Serial.print("Current time rozzo: ");
  Serial.print(tempoRozzo);
  Serial.print(" ");
  Serial.print(currentDate);
  Serial.println();

  // Send time to the App
  Blynk.virtualWrite(V50, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V51, currentDate);

  
  if (tempoRozzo == String("830") || tempoRozzo == String("2030")) //orari in cui notificare su terminal la temperatura  
{
  terminal.print(currentDate);
  terminal.print(" ore ");
  terminal.print(currentTime);
  terminal.print(" rilevati ");
  terminal.print(sensors.getTempCByIndex(0));
  terminal.println(" gradi");
  terminal.flush();
}

}

void loop() {
Blynk.run();
timer.run(); // esegue timer
}

I can’t see on your code where you read the timer input, have a look here Timer widget

Example suggests param.asStr() as a return from the timer widget. I personally would use Boolean as True and False instead of High and Low

Thanks Idb, the Timer Widget is on pin V3. In this case the variable “attivato” could be 0 or 1.
The sketch run properly in my device (Android OS), but not in IOS (tapping on Timer Widget is not possible to set the start/stop time)

The project author has to stop project and open Timer widget settings to setup start/stop time.
This will be improved in the next 2.24 ios app version.

Related: Timers and Shared Access

1 Like