Timer input not select day of the week

Helo all, Timer input not select day of week, select any day returns 1.
Blynk iot update ver 1.11.2(135) sgp1

I didn’t get this error before, just got it recently!

TimeInputParam t(param);
  // Process Blynk TimeInput weekdays (1. Mon, 2. Tue, 3. Wed, 4. Thu, 5. Fri, 6. Sat, 7. Sun)
  // Process RTC weekday();           (1. Sun, 2. Mon, 3. Tue, 4. Wed, 5. Thu, 6. Fri, 7. Sat) 
  // Bit dayStart/StopSelect  (0. None 1. Sun, 2. Mon, 3. Tue, 4. Wed, 5. Thu, 6. Fri, 7. Sat)
  
  for (int i = 1; i <= 7; i++){
    if (t.isWeekdaySelected(i)) { 
    Serial.println(String("Day ") + t.isWeekdaySelected(i) + " is selected");
      if (i == 7) {
        bitWrite(myTimer[0].dayStartSelect, 1,   1);
        bitWrite(myTimer[0].dayStopSelect,  1,   1);
      }
      else {
        bitWrite(myTimer[0].dayStartSelect, i + 1, 1);
        bitWrite(myTimer[0].dayStopSelect,  i + 1, 1);
      }
      //Serial.println(String("Day ") + t.isWeekdaySelected(i) + " is selected");
    }
  }

[3357] Connecting to blynk.cloud:80
[3602] Ready (ping: 144ms).
Day 1 is selected
Day 1 is selected
Day 1 is selected
Day 1 is selected
Day 1 is selected
Day 1 is selected

You need to post your full sketch for us to understand where within your sketch this snippet of code lies, so we know when it is being processed.

What datastream is your Time Input widget attached to, and what data type do you have defined for that datastream?

Are you using the Android or iOS app? Do you have the opportunity to test this on the other phone OS?

Pete.

1 Like

helo peter,
normally it is still used normally, it was just a few days ago!

google pixel 5 andriod 13



/*************************************************************
  Blynk is a platform with iOS and Android apps to control
  ESP32, Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build mobile and web interfaces for any
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: https://www.blynk.io
    Sketch generator:           https://examples.blynk.cc
    Blynk community:            https://community.blynk.cc
    Follow us:                  https://www.fb.com/blynkapp
                                https://twitter.com/blynk_app

  Blynk library is licensed under MIT license
 *************************************************************
  Blynk.Edgent implements:
  - Blynk.Inject - Dynamic WiFi credentials provisioning
  - Blynk.Air    - Over The Air firmware updates
  - Device state indication using a physical LED
  - Credentials reset using a physical Button
 *************************************************************/

/* Fill in information from your Blynk Template here */
/* Read more: https://bit.ly/BlynkInject */
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_TEMPLATE_NAME "test"
#define BLYNK_AUTH_TOKEN ""
#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
#define WIFI "IoT"
#define PASS ""
#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_ESP32_DEV_MODULE
//#define USE_ESP32C3_DEV_MODULE
//#define USE_ESP32S2_DEV_KIT
//#define USE_WROVER_BOARD
//#define USE_TTGO_T7
//#define USE_TTGO_T_OI



#include <BlynkSimpleEsp32.h>
#include <TimeLib.h>
#include <EEPROM.h>
//#include <DHTesp.h>
#include <PZEM004Tv30.h>  // <--- https://github.com/mandulaj/PZEM-004T-v30
//#include <driver/adc.h>
//#include "EmonLib.h"                   // Include Emon Library
//EnergyMonitor emon1;                   // Create an instance
//#define ADC_INPUT 34
//DHTesp dht;
BlynkTimer timer;




#define RX1 16
#define TX1 17 //26
#define RX 13
#define TX 32 //32
#define PZEM_SERIAL1 Serial2
#define PZEM_SERIAL Serial1
PZEM004Tv30 pzems(PZEM_SERIAL,   RX, TX);  //gan nha
PZEM004Tv30 pzems1(PZEM_SERIAL1, RX1, TX1); // xa nha
//PZEM004Tv30 pzems(&Serial2); //hwserial UART2 at pins IO-16 (RX2) and IO-17 (TX2)
/*
PZEM004Tv30 pzem[] = {
    PZEM004Tv30(PZEM_SERIAL, RX, TX, 0x10), // gan nha
    PZEM004Tv30(PZEM_SERIAL, RX, TX, 0x11), // xa nha
    //PZEM004Tv30(&Serial2, 0x12)
    };
  */  
//float Energy;
//float LechDongDien = 5.00, nhaptimes = 10.00, Seconds; //dong dien mac dinh 5A

byte chonkhu;

//********************************************************
//------Bao dong chong den-----
struct MyGiaTri
{
  float Current[3], Current1[3];
  float buocSutAmpe,LechDongDien ;
  int  Ampe, vol[2];
  int  nhaptimes, DemTime =0;
  int  BaodongDienTL, demnguoc;
  bool aaa = 0;
  
};
MyGiaTri mygiatri;
char DemTime[3];
bool alert_sent[2] = {0, 0};  //tranh lap lai thong bao.
float temps, temps1;
//   ----Set up your relay pins here----- 
const bool RelayTrigger = 0;
struct MY_RELAY_PINS
{
  const byte RelayPin;
  bool       RelayState;
  bool       RelayState_;
  const byte RelayVirual;
  //WidgetLED  led;
};
std::vector<MY_RELAY_PINS> myRelayPins = 
{
  {23, RelayTrigger, RelayTrigger, V0},  // 23  den TL, 
  {22, RelayTrigger, RelayTrigger, V1},  // 22  den bao/coi bao dong
  //{21, RelayTrigger, RelayTrigger, V2, V12},  // 21  bom tuoi 1 - 2
  //{19, RelayTrigger, RelayTrigger, V3, V13},  // 19  bom tuoi 2 - 1
  //{18, RelayTrigger, RelayTrigger, V4, V14},  // 18  bom tuoi 2 - 2
  //{5,  RelayTrigger, RelayTrigger, V5, V15},  // 5   den chong TL
  //{4,  RelayTrigger, RelayTrigger, V6, V16},  // 4   den Ho
  //{27, RelayTrigger, RelayTrigger, V7, V17},  // 4   den Nga 3
};


//*************** Hen gio ***********************************
//Set up your timer here 
//const byte J = 1;
struct MY_TIMER
{
  unsigned long start1seconds;
  unsigned long stop1seconds;
  byte          dayStartSelect;
  byte          dayStopSelect; 
};
std::vector<MY_TIMER> myTimer = 
{
  {1000000, 1000000, 0, 0},
  //{1000000, 1000000, 0, 0},
};

//bool Biencupdien = 0; // kiem tra cup dien
char ClockTime[16];                // Char Array to hold current time
char ClockDate[16];
unsigned long daySeconds;           // current time in seconds since midnight
byte today;

//--------------------------------------------
/*
struct MyEeproms {
  int   Savetimedelays;
  byte  CheckMonth;
  float KwhThagTruoc;
};
MyEeproms SaveEeprom;
*/
//#define cambienmucnuoc 15    // chan cam bien muc nuoc day
//#define tPin 34            // chan cam bien nhiet do
//#define quatlammat 4       // den nga 3
//bool bienDelay = 0;          // on off delay bom HT. 1 = off. V40
//unsigned long nhapTime = 180000;           // nhap time de delay 3p(60000 = 1p)
//int CountdownRemain, CountdownRemainReset, CountdownTimer; // delay bom HT
//byte chinhNhietDo;         // chinh nhiet do lam mat, min 35 *C   V50

//*******************************************************************
#include <Ticker.h>  //for LED status
#define SOS_PIN 2
Ticker blinker;
Ticker toggler;
Ticker changer;
float blinkerPace = 0.2;  //seconds
const float togglePeriod = 2.5; //seconds

BLYNK_CONNECTED() {
//  Request the latest state from the server
 Blynk.syncVirtual(V0,V1,V20,V21,V22,V23,V30,V32);
 delay(100);
 Blynk.sendInternal("rtc", "sync");
 //Blynk.setProperty(V32, "step", 1);

 
  
}

//******************************************************************
void setup(){
 Serial.begin(115200);
 delay(100);
 //timer.setTimeout(10L, []() {
     //Sacrificial Timer
  //});
  for(int i = 0; i< myRelayPins.size(); i++){
    pinMode(myRelayPins[i].RelayPin, OUTPUT);
    digitalWrite(myRelayPins[i].RelayPin, myRelayPins[i].RelayState);
  }
  pinMode(SOS_PIN, OUTPUT);
  //pinMode(cambienmucnuoc, INPUT);            //chan do nuoc ho day
  //pinMode(tPin, INPUT);                    //chan ngo vao do nhiet do, do am
  //pinMode(RelayPin7, OUTPUT);              //chan dieu khien quat lam mat
  
  //pinMode(SwitchPin1, INPUT_PULLUP);
  
 //emon1.current(ADC_INPUT, 30);  // Initialize emon library (30 = calibration number)
 EEPROM.begin(512);
 delay(100);
 Blynk.begin(BLYNK_AUTH_TOKEN,WIFI, PASS);
 //Blynk.connect();
 timer.setInterval(600000UL, temppp);
 //timer.setTimeout(10000L, []() {
   timer.setInterval(3000L, timeChecker);
 //});
 //CountdownTimer = timer.setInterval(1000L, CountdownTimerFunction);
 //timer.disable(CountdownTimer); // disable it on boot
 
 mygiatri.BaodongDienTL = timer.setInterval(1000L, baodongsutAmp);
 timer.disable(mygiatri.BaodongDienTL); // disable it on boot
 
 timer.setInterval(2000L,CSDien);
 //timer.setInterval(1200000UL, resetenergy);
 
 }
//*******************************************************
void loop(){
  Blynk.run();
  timer.run(); // Initiates SimpleTimer
  DisplayTimes();
  //autoReboot();
  //nhietdotudien();
}

void DisplayTimes(){
  unsigned long lastMillis = 0;
  if ((unsigned long) (millis() - lastMillis) >= 1000L){
   lastMillis = millis();
  Blynk.sendInternal("rtc", "sync");
  }
}

void temppp(){
  //fix err timer.setInterval... id 0
}

//***********************auto reboot 7 days********************
void autoReboot(){
  if ((daySeconds == 63000) && (day() == 2)){
    delay(2000);
    ESP.restart();
  }
}
/*
BLYNK_WRITE(V25){
  //int rssi = WiFi.RSSI();
  if (WL_CONNECTED){
  Blynk.virtualWrite(V25, WiFi.RSSI());
  Blynk.virtualWrite(V26, WiFi.SSID());
  }
}
*/
/*
BLYNK_WRITE(V99){
  if (param.asInt()){
    delay(2000);
    ESP.restart();
  }
}
*/
//   ******   Đèn TL   *******
BLYNK_WRITE(V0) {
  myRelayPins[0].RelayState = param.asInt();
  digitalWrite(myRelayPins[0].RelayPin, myRelayPins[0].RelayState);  
  if ((myRelayPins[0].RelayState == !RelayTrigger) && (myRelayPins[0].RelayState_ == RelayTrigger)) {
    //myRelayPins[0].led.on();
    Blynk.logEvent("n_thanh_long", String("Đèn chong Thanh Long đã bật"));  
    mygiatri.demnguoc = timer.setTimeout(10000L, [] (){ //tre 10s
      myRelayPins[0].RelayState_ = myRelayPins[0].RelayState;
      timer.enable(mygiatri.BaodongDienTL);
    });
  }
  else if  ((myRelayPins[0].RelayState == RelayTrigger) && (myRelayPins[0].RelayState_ == !RelayTrigger)){ 
    //timer.deleteTimer(BaodongDienTL);
    myRelayPins[0].RelayState_ = myRelayPins[0].RelayState;
    //myRelayPins[0].led.off();
    timer.disable(mygiatri.BaodongDienTL);
    mygiatri.DemTime = 0;
    mygiatri.aaa = 0;
    alert_sent[0] = 0;
    alert_sent[1] = 0;
    Blynk.logEvent("n_thanh_long", String("Đèn chong Thanh Long đã tắt"));
    //Blynk.virtualWrite(V24, " "," "," "," "," ");
  }
  else if (myRelayPins[0].RelayState == RelayTrigger){
    //myRelayPins[0].led.off();
    //timer.deleteTimer(BaodongDienTL);
    myRelayPins[0].RelayState_ == RelayTrigger;
    timer.disable(mygiatri.BaodongDienTL);
    timer.disable(mygiatri.demnguoc);
    mygiatri.DemTime = 0;
    mygiatri.aaa = 0;
    alert_sent[0] = 0;
    alert_sent[1] = 0;
    //Blynk.virtualWrite(V24, " "," "," "," "," ");
  }
}

//****** Đèn Báo/ Còi hú************************
BLYNK_WRITE(V32) {
  chonkhu = param.asInt();
  if (chonkhu==0){
    Blynk.setProperty(V32, "label", "chọn khu TL cần chong đèn: 1-Đám dưới, 2-Đám trên, 3-Cả 2 đám.");
  }
  else if (chonkhu==1){
    Blynk.setProperty(V32, "color", "#D3435C"); //-- red
    Blynk.setProperty(V32, "label", "Chong đèn đám dưới(1)");
    //Blynk.setProperty(V32, "label", "Đám TL dưới chong đèn");
 }

 else if (chonkhu == 2){
   Blynk.setProperty(V32, "color", "#0903FE");// -- green
   Blynk.setProperty(V32, "label", "Chong đèn đám trên(2)");
 }
 else if(chonkhu==3){
   Blynk.setProperty(V32, "color", "FAA605");
   Blynk.setProperty(V32, "label", "Chong đèn cả 2 đám đám(3)");
 }
}


void change() {
  blinkerPace = 0.4;
  
}

void blink() {
  digitalWrite(SOS_PIN, !digitalRead(SOS_PIN));
}

void toggle() {
  static bool isBlinking = false;
  if (isBlinking) {
    blinker.detach();
    isBlinking = false;
  }
  else {
    blinker.attach(blinkerPace, blink);
    isBlinking = true;
  }
  digitalWrite(SOS_PIN, LOW);  //make sure LED on on after toggling (pin LOW = led ON)
}

//////////////////////////////////
void CSDien(){
  mygiatri.vol[0]=pzems.voltage();
  mygiatri.vol[1]=pzems1.voltage();
  mygiatri.Current[0]  = pzems.current();   //-------gần nhà----
  mygiatri.Current1[0] = pzems1.current();  //------ xa nhà-----------
  if(isnan(pzems.voltage())){
    mygiatri.vol[0] = 0;
  }
  if(isnan(pzems1.voltage())){
    mygiatri.vol[1] = 0;
  }
  Blynk.virtualWrite(V26, "Gan nha: ",mygiatri.vol[0],"== Xa nha: ",mygiatri.vol[1]);
  if(!myRelayPins[0].RelayState_){
    if (!isnan(mygiatri.Current[0])){
      Blynk.virtualWrite(V24, mygiatri.Current[0]);  //   Gần nhà
    }
    else{
      Blynk.virtualWrite(V24, 0.000);
    }
    if (!isnan(mygiatri.Current1[0])){
      Blynk.virtualWrite(V25, mygiatri.Current1[0]); //   xa nhà
    }
    else{
      Blynk.virtualWrite(V25, 0.000);
    }
  }
  
  //resetenergy();
}


//*****************  Canh bao su co chong den Thanh Long, dua vao su thay doi dong dien   ********************
void ThongBaoSuCo(int key){
  switch(key){
    ///// ----------------gần nhà-------------------------
    case 0:
      //Blynk.virtualWrite(myRelayPins[1].RelayVirual, !RelayTrigger);
      //Blynk.syncVirtual(myRelayPins[1].RelayVirual);
      //Blynk.logEvent("damduoi", String("Dòng điện giảm đột ngột: ") + (mygiatri.Current[0] - mygiatri.Current[1]) + String(" Ampe trong 1 giây"));
      break;
    case 1:
      //Blynk.virtualWrite(myRelayPins[1].RelayVirual, !RelayTrigger);
      //Blynk.syncVirtual(myRelayPins[1].RelayVirual);
     if (!alert_sent[0]){
      SOS();
       //Blynk.logEvent("damduoi", String("Dòng điện giảm còn ")+ mygiatri.Current[0] + String(" Ampe so với mức ") + mygiatri.Ampe +String(" Ampe"));
       alert_sent[0] = 1;
     }
      break;
    case 2:
      //Blynk.virtualWrite(myRelayPins[1].RelayVirual, !RelayTrigger);
      //Blynk.syncVirtual(myRelayPins[1].RelayVirual);
      //Blynk.logEvent("damduoi", String("Dòng điện bị giảm ") + (mygiatri.Current[0] - mygiatri.Current[2]) + String(" Ampe trong ") + mygiatri.nhaptimes + String(" giây"));
      break;
//------------------xa nhà ---------------
    case 10:
      //Blynk.virtualWrite(myRelayPins[1].RelayVirual, !RelayTrigger);
      //Blynk.syncVirtual(myRelayPins[1].RelayVirual);
      //Blynk.logEvent("damtren", String("Dòng điện giảm đột ngột: ") + (mygiatri.Current1[0] - mygiatri.Current1[1]) + String(" Ampe trong 1 giây"));
      break;
    case 11:
      //Blynk.virtualWrite(myRelayPins[1].RelayVirual, !RelayTrigger);
      //Blynk.syncVirtual(myRelayPins[1].RelayVirual);
     if (!alert_sent[1]){
      SOS();
       //Blynk.logEvent("damtren", String("Dòng điện giảm còn ")+ mygiatri.Current1[0] + String(" Ampe so với mức ") + mygiatri.Ampe +String(" Ampe"));
       alert_sent[1] = 1;
       
     }
      break;
    case 12:
      //Blynk.virtualWrite(myRelayPins[1].RelayVirual, !RelayTrigger);
      //Blynk.syncVirtual(myRelayPins[1].RelayVirual);
      //Blynk.logEvent("damtren", String("Dòng điện bị giảm ") + (mygiatri.Current1[0] - mygiatri.Current1[2]) + String(" Ampe trong ") + mygiatri.nhaptimes + String(" giây"));
      break;

    default : break; 
  }
}


void SOS(){
    timer.setTimeout(30000L, [](){
      //myRelayPins[1].RelayState = 0;
      //Blynk.syncVirtual(V1, 0);
      toggler.detach();
      changer.detach();
    });
    toggler.attach(togglePeriod, toggle);
    changer.once(15, change);
}

 BLYNK_WRITE (V22){     //nhap dong dien de so sanh dong dien tai, de dat bao dong -------gan nha
  mygiatri.Ampe = param.asInt();
 }
 
BLYNK_WRITE(V23){      // bao dong khi bi giam dong dien dot ngot/s 
  mygiatri.buocSutAmpe = param.asFloat();
  delay(100);
}

 // =============theo doi su thay doi dong dien de phat canh bao============
void baodongsutAmp(){  
  mygiatri.DemTime += 1;
  mygiatri.Current[0]  = pzems.current();   //-------gần nhà----
  mygiatri.Current1[0] = pzems1.current();  //------ xa nhà-----------
  Blynk.virtualWrite(V24, mygiatri.Current[0]);  //-------gần nhà----
  Blynk.virtualWrite(V25, mygiatri.Current1[0]); //------ xa nhà-----------
  //Blynk.virtualWrite(V31, mygiatri.DemTime,"gan nha: ", temps,"xa nha: ", temps1 );
  if (mygiatri.DemTime >= mygiatri.nhaptimes){
      mygiatri.aaa = 1;
      mygiatri.DemTime = 0;
  }
  else {
    mygiatri.aaa = 0;
  }
  
  
  //if (mygiatri.vol[0]>=200){
    BaoDongTLSatNha();
  //}
  //if (mygiatri.vol[1]>=200){
  //  BaoDongTLXaNha();
  //}
}

///------------------ đám Thanh Long sát nhà--------------------
void BaoDongTLSatNha(){      
   if (mygiatri.Current[0] >= mygiatri.Ampe){
    if ((mygiatri.Current[0] - mygiatri.Current[1]) < mygiatri.buocSutAmpe){
      ThongBaoSuCo(0);
    } 
    mygiatri.Current[1] = mygiatri.Current[0]; 
    if (mygiatri.aaa){
      temps = mygiatri.Current[0] - mygiatri.Current[2];
      if ((mygiatri.Current[0] - mygiatri.Current[2]) < mygiatri.LechDongDien){
        ThongBaoSuCo(2);
      } 
      mygiatri.Current[2] = mygiatri.Current[0]; 
    }
    alert_sent[0] = 0;
  }
  else {
     ThongBaoSuCo(1);
  }
}

///  --------------đám Thanh Long xa nhà----------------
void BaoDongTLXaNha(){
   
   if (mygiatri.Current1[0] >= mygiatri.Ampe){
    if ((mygiatri.Current1[0] - mygiatri.Current1[1]) < mygiatri.buocSutAmpe){
      ThongBaoSuCo(10);
    } 
    mygiatri.Current1[1] = mygiatri.Current1[0]; 
    if (mygiatri.aaa){
      temps1 = mygiatri.Current1[0] - mygiatri.Current1[2];
      if ((mygiatri.Current1[0] - mygiatri.Current1[2]) < mygiatri.LechDongDien){
        ThongBaoSuCo(12);
      } 
      mygiatri.Current1[2] = mygiatri.Current1[0]; 
    }
    alert_sent[1] = 0;
  }
  else {
     ThongBaoSuCo(11);
  }
}

//==================================
BLYNK_WRITE(V21){ // thoi gian tuong ung voi si thay doi dong dien
  int temps;
  mygiatri.nhaptimes = param.asInt(); // giay
  delay(100);
  if (mygiatri.nhaptimes != temps){
    mygiatri.DemTime = 0;
    
  }
  temps = mygiatri.nhaptimes;
}

BLYNK_WRITE(V20){ // dong dien thay doi theo thoi gian dat o tren
  float temp2;
  mygiatri.LechDongDien = param.asFloat();
  delay(100);
  if (mygiatri.LechDongDien != temp2){
    mygiatri.DemTime = 0;
   
  }
  temp2 = mygiatri.LechDongDien;
}



//************* hiển thị ngày giờ**********************
BLYNK_WRITE(InternalPinRTC){
  const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013
  unsigned long blynkTime = param.asLong();
  if (blynkTime >= DEFAULT_TIME) {
  setTime(blynkTime);
  today= weekday();
  daySeconds = (hour()*3600) + (minute()*60) + second();
  sprintf(ClockTime, "%02d:%02d:%02d", hour(), minute(), second());
  sprintf(ClockDate, "%02d:%02d:%02d", day(), month(), year());
  sprintf(DemTime, "%02d", mygiatri.DemTime);
  Blynk.virtualWrite(V29, ClockTime,"    ",DemTime,"    ", ClockDate);
  setSyncInterval(3600);
  }
}

//****************Hen Gio*************************************************
void timeChecker() {   // daySeconds is actual elapsed seconds since midnight
  for (int i = 0; i < myTimer.size(); i++){
    
    
     if ((myRelayPins[i].RelayState == RelayTrigger) && (bitRead(myTimer[i].dayStartSelect, today))){      //  time start 
        if((daySeconds >= myTimer[i].start1seconds)&&(daySeconds <= myTimer[i].start1seconds + 6)){
          Blynk.virtualWrite(myRelayPins[i].RelayVirual, !RelayTrigger);
          Blynk.syncVirtual(myRelayPins[i].RelayVirual);
        }
      }

     else if ((myRelayPins[i].RelayState == !RelayTrigger) && (bitRead(myTimer[i].dayStopSelect,  today))){  //time stop  
      if((daySeconds >= myTimer[i].stop1seconds)&&(daySeconds <= myTimer[i].stop1seconds + 6)) {
        Blynk.virtualWrite(myRelayPins[i].RelayVirual, RelayTrigger);
        Blynk.syncVirtual(myRelayPins[i].RelayVirual);
      }  
     }
  }
}
//*********************************************
BLYNK_WRITE(V30) {      // Bom HT    
  TimeInputParam t(param);
  // Process Blynk TimeInput weekdays (1. Mon, 2. Tue, 3. Wed, 4. Thu, 5. Fri, 6. Sat, 7. Sun)
  // Process RTC weekday();           (1. Sun, 2. Mon, 3. Tue, 4. Wed, 5. Thu, 6. Fri, 7. Sat) 
  // Bit dayStart/StopSelect  (0. None 1. Sun, 2. Mon, 3. Tue, 4. Wed, 5. Thu, 6. Fri, 7. Sat)
  
  for (int i = 1; i <= 7; i++){
    if (t.isWeekdaySelected(i)) { 
    Serial.println(String("Day ") + t.isWeekdaySelected(i) + " is selected");
      if (i == 7) {
        bitWrite(myTimer[0].dayStartSelect, 1,   1);
        bitWrite(myTimer[0].dayStopSelect,  1,   1);
      }
      else {
        bitWrite(myTimer[0].dayStartSelect, i + 1, 1);
        bitWrite(myTimer[0].dayStopSelect,  i + 1, 1);
      }
      //Serial.println(String("Day ") + t.isWeekdaySelected(i) + " is selected");
    }
  }
  if (param[0].asLong()) {                                             // Process start time
    myTimer[0].start1seconds = param[0].asLong();
  }
  else {
    myTimer[0].start1seconds = 1000000;
  }
    
  if (param[1].asLong()) {                                              // Process stop time
    myTimer[0].stop1seconds = param[1].asLong();    
  }
  else {
    myTimer[0].stop1seconds = 1000000;
  }
}


//**********************************END*******************************

You don’t seem to like answering questions!

What datastream is your Time Input widget attached to - Not Answered. Your code assumes V30

What data type do you have defined for that datastream? - V30 is a String data tyupe, but we don’t know yet where your Time Input widget uses this datastream

Are you using the Android or iOS app - Android

Do you have the opportunity to test this on an iOS device - Not Answered

As far as your code is concerned, it obviously started life as an Edgent example and you’ve converted it into a non-Edgent sketch. You’ve left lots of Edgent code lying around, which makes it very messy.

Why are you calling DisplayTimes() from your void loop rather than with a BlynkTimer and why are you calling Blynk.sendInternal("rtc", "sync") once every second?
You only need to synchronise your ESP32 with the Blynk server for the following reasons

  • to correct for time drift in the ESP32, which is extremely small (about 2 seconds per day)
  • to set the time when the device reboots (handled by `BLYNK_CONNECTED)
  • to cope with daylight saving time, which is normally one hour, twice per year but isn’t used in Vietnam.

Pete.

1 Like

sr Peter!
*Do you have the opportunity to test this on an iOS device, i’m not ios.

I want to add a clock on the app. Show Times-date

That’s still no reason to ask the Blynk server whet the current time is once every second. You might want to write the current time to a datastream once per second, but you don’t really need to synchronise the ESP32 with the Blynk server more than twice per day.

Pete.

1 Like

Shouldn’t this like of code…

say…

Serial.println(String("Day ") + i + " is selected");

Pete.

1 Like

tks Pete!
let me try again

Did this fix your problem? Should we mark this as “Solved”?

Peye.

1 Like

I’m still looking for errors ~~, sr Pete!

helo pete!
I don’t have ios to test. Maybe it’s because blynk iot app. Before, I used it normally!

Maybe you need to clarify exactly what your issue is, once you make the suggested change to your for loop.

Pete.