setProperty in automation Blynk IOT

Hi, Im currently deveping a project to control 100 WS812B RGB Led using Blynk IOT. currently, im using free plan and limited to only 50 datastreams. To control all 100 leds individually, Im using a slider and 10 virtual pins.

project principle:
when slider == 1, V0 = 1, V2 = 2, …, V9 = 10
when slider == 2, V0 = 11, V2 =12, …, V9 = 10

Screenshot:

So, everytime slider changes value, the onLabels and offLabel of every virtual pin need to change. right now im using for loop to call Blynk.setProperty(V0, “onLabel”, “”); but it is slow updating the on and off labels.
sample codes:

#include <FastLED.h>

#define BUT_FREE                     0
#define BUT_PRESSED                  1
#define BUT_LOCKED                   2

#define LED_PIN                     14
#define COLOR_ORDER                GRB
#define CHIPSET                 WS2812
#define NUM_LEDS                   100

#define BLYNK_DARK_BLUE      "#5F7CD8"
#define BLYNK_RED            "#D3435C"
#define BLYNK_GREEN          "#23C48E"

//LED VIRTUAL PIN TAB 2
#define VIRT_BUT_TAB2_0             V0
#define VIRT_BUT_TAB2_1             V1
#define VIRT_BUT_TAB2_2             V2
#define VIRT_BUT_TAB2_3             V3
#define VIRT_BUT_TAB2_4             V4
#define VIRT_BUT_TAB2_5             V5
#define VIRT_BUT_TAB2_6             V6
#define VIRT_BUT_TAB2_7             V7
#define VIRT_BUT_TAB2_8             V8
#define VIRT_BUT_TAB2_9             V9

#define VIRTUAL_SLIDER              V10
#define VIRTUAL_LED                 V11

#define VIRTUAL_TAB2_CONTROL        V20
#define VIRTUAL_TAB3_CONTROL        V21
#define VIRTUAL_LED_SPEED           V22
#define VIRTUAL_RED_LED_PIN         V23
#define VIRTUAL_GREEN_LED_PIN       V24
#define VIRTUAL_BLUE_LED_PIN        V25

#define VIRTUAL_LED_ANIMATION_1     V31

#define NO_LED_ANIMATION              0

#define BRIGHTNESS                  200
#define FRAMES_PER_SECOND            20

WidgetLED led(VIRTUAL_LED);
CRGB ledstrip[NUM_LEDS];

//TAB 2 setting
short gsSliderValue = 1;
short gsSliderValue_Bef = 0;
short gsWhichAnimation = NO_LED_ANIMATION;

unsigned short gusLED_Speed = 20;
unsigned short gusIsNeed_Animation = 0;
unsigned short gusIsNeed_Update = 0;
unsigned short gusTabControl = VIRTUAL_TAB2_CONTROL;
unsigned short gusTabControl_Bef = VIRTUAL_TAB3_CONTROL;

unsigned short gusRGB_Value[] = {0, 255, 255};
unsigned short gusIsBut_Pressed[] = {BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE,BUT_FREE};      
unsigned short gusIsBut_Pressed_Bef[] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,};

void setup()
{
  // Debug console
  Serial.begin(115200);
  
  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(ledstrip, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness( BRIGHTNESS );
  
  Blynk.begin(auth, ssid, pass);
  led.on();
  led.setColor(BLYNK_RED);

  Blynk.virtualWrite(VIRTUAL_SLIDER, gsSliderValue);
  Blynk.virtualWrite(VIRTUAL_RED_LED_PIN, gusRGB_Value[0]);
  Blynk.virtualWrite(VIRTUAL_GREEN_LED_PIN, gusRGB_Value[1]);
  Blynk.virtualWrite(VIRTUAL_BLUE_LED_PIN, gusRGB_Value[2]);
  Blynk.virtualWrite(VIRTUAL_LED_SPEED, gusLED_Speed);
  
  vCheck_TabControl();
  Blynk.syncAll();
}

void loop()
{
  char szLabel_On[10];
  char szLabel_Off[10];
  short sIndex = 0;
  Blynk.run();
  
  //update label
  if(gusIsNeed_Update == 0)
  {
    for(short i = 1; i <= 10; i++)
    {
      if(i == gsSliderValue)
      {
        vLabel_Control(i);
      }
    }
    gusIsNeed_Update = 1;
  }

  vLED_Control();
}

void vLabel_Control(short sSliderValue)
{
  char szLabel_On[10];
  char szLabel_Off[10];
  short sIndex = sGetLED_Index(sSliderValue);
  
  led.on();
  led.setColor(BLYNK_RED);
  
  for(short i=0; i<10; i++)
  {
    Blynk.run();
    if((gusIsBut_Pressed[i+sIndex] != gusIsBut_Pressed_Bef[i+sIndex]) || (sSliderValue != gsSliderValue_Bef) || (gusTabControl != gusTabControl_Bef))
    {
      memset(szLabel_On, '\0', sizeof(szLabel_On));
      memset(szLabel_Off, '\0', sizeof(szLabel_Off));
  
      if((gusIsBut_Pressed_Bef[i+sIndex] == BUT_LOCKED) || (gusTabControl == VIRTUAL_TAB3_CONTROL))
      {
        sprintf(szLabel_On, "%d LOCKED", i+sIndex+1);
        sprintf(szLabel_Off, "%d FREE", i+sIndex+1);
        
        if((gusIsBut_Pressed[i+sIndex] == BUT_LOCKED) || (gusTabControl == VIRTUAL_TAB2_CONTROL))
        {
          Blynk.virtualWrite(i, HIGH);
          gusIsBut_Pressed[i+sIndex] = BUT_LOCKED;
        }
        else
        {
          Blynk.virtualWrite(i, LOW);
        }
      }
      else
      {
        sprintf(szLabel_On, "%d ON", i+sIndex+1);
        sprintf(szLabel_Off, "%d OFF", i+sIndex+1);
        
        Blynk.virtualWrite(i, gusIsBut_Pressed[i+sIndex]);
      }

      if(gusIsBut_Pressed[i+sIndex] == BUT_LOCKED)
      {
        Blynk.setProperty(i, "color", BLYNK_RED);
      }
      else
      {
        Blynk.setProperty(i, "color", BLYNK_DARK_BLUE);
      }
      
      Blynk.setProperty(i, "onLabel", szLabel_On);
      Blynk.setProperty(i, "offLabel", szLabel_Off);
      
      gusIsBut_Pressed_Bef[i+sIndex] = gusIsBut_Pressed[i+sIndex];
    }
  }
  
  led.on();
  led.setColor(BLYNK_GREEN);
  
  if(sSliderValue != gsSliderValue_Bef)
  {
    gsSliderValue_Bef = sSliderValue;
  }

  if(gusTabControl != gusTabControl_Bef)
  {
    gusTabControl_Bef = gusTabControl;
  }
}
BLYNK_WRITE(VIRTUAL_LED_SPEED)
{
  gusLED_Speed = param.asInt();
}
BLYNK_WRITE(VIRTUAL_RED_LED_PIN)
{
  gusRGB_Value[0] = param.asInt();
}
BLYNK_WRITE(VIRTUAL_GREEN_LED_PIN)
{
  gusRGB_Value[1] = param.asInt();
}
BLYNK_WRITE(VIRTUAL_BLUE_LED_PIN)
{
  gusRGB_Value[2] = param.asInt();
}
BLYNK_WRITE(VIRTUAL_LED_ANIMATION_1)
{
  gusIsNeed_Animation = param.asInt();
}
BLYNK_WRITE(VIRTUAL_SLIDER)
{
  short sSliderValue = param.asInt();

  gsSliderValue = sSliderValue;
  gusIsNeed_Update = 0;
}

BLYNK_WRITE(VIRTUAL_TAB2_CONTROL)
{
  short sStatus = param.asInt();

  if(sStatus == HIGH)
  {
    gusTabControl = VIRTUAL_TAB2_CONTROL;
  }
  else
  {
    gusTabControl = VIRTUAL_TAB3_CONTROL;
  }
    
  vCheck_TabControl();
}

BLYNK_WRITE(VIRTUAL_TAB3_CONTROL)
{
  short sStatus = param.asInt();

  if(sStatus == HIGH)
  {
    gusTabControl = VIRTUAL_TAB3_CONTROL;
  }
  else
  {
    gusTabControl = VIRTUAL_TAB2_CONTROL;
  }
    
  vCheck_TabControl();
}

void vCheck_TabControl()
{
  if(gusTabControl == VIRTUAL_TAB2_CONTROL)
  {
    Blynk.virtualWrite(VIRTUAL_TAB2_CONTROL, HIGH);
    Blynk.virtualWrite(VIRTUAL_TAB3_CONTROL, LOW);
  }
  else if(gusTabControl == VIRTUAL_TAB3_CONTROL)
  {
    Blynk.virtualWrite(VIRTUAL_TAB2_CONTROL, LOW);
    Blynk.virtualWrite(VIRTUAL_TAB3_CONTROL, HIGH);
  }
  
  gusIsNeed_Update = 0;
}

void vButLock_Set(short sWhichPin, short sOnOff)
{
  short sIndex = sGetLED_Index(gsSliderValue);
  //Serial.print("sIndex: ");Serial.println(sIndex);
  
  if(gusTabControl == VIRTUAL_TAB3_CONTROL)
  {
    if(sOnOff == HIGH)
    {
      gusIsBut_Pressed[sWhichPin + sIndex] = BUT_LOCKED;
    }
    else
    {
      gusIsBut_Pressed[sWhichPin + sIndex] = BUT_FREE;
    }
  }
  else
  {
    if(gusIsBut_Pressed_Bef[sWhichPin + sIndex] != BUT_LOCKED)
    {
      if(sOnOff == HIGH)
      {
        gusIsBut_Pressed[sWhichPin + sIndex] = BUT_PRESSED;
      }
      else
      {
        gusIsBut_Pressed[sWhichPin + sIndex] = BUT_FREE;
      }
    }
    else
    {
      Blynk.virtualWrite(sWhichPin, HIGH);
    }
  }

  gusIsNeed_Update = 0;
}

BLYNK_WRITE(VIRT_BUT_TAB2_0)
{
  short sStatus = param.asInt();
  vButLock_Set(VIRT_BUT_TAB2_0,sStatus);
}
BLYNK_WRITE(VIRT_BUT_TAB2_1)
{
  short sStatus = param.asInt();
  vButLock_Set(VIRT_BUT_TAB2_1,sStatus);
}
BLYNK_WRITE(VIRT_BUT_TAB2_2)
{
  short sStatus = param.asInt();
  vButLock_Set(VIRT_BUT_TAB2_2,sStatus);
}
BLYNK_WRITE(VIRT_BUT_TAB2_3)
{
  short sStatus = param.asInt();
  vButLock_Set(VIRT_BUT_TAB2_3,sStatus);
}
BLYNK_WRITE(VIRT_BUT_TAB2_4)
{
  short sStatus = param.asInt();
  vButLock_Set(VIRT_BUT_TAB2_4,sStatus);
}
BLYNK_WRITE(VIRT_BUT_TAB2_5)
{
  short sStatus = param.asInt();
  vButLock_Set(VIRT_BUT_TAB2_5,sStatus);
}
BLYNK_WRITE(VIRT_BUT_TAB2_6)
{
  short sStatus = param.asInt();
  vButLock_Set(VIRT_BUT_TAB2_6,sStatus);
}
BLYNK_WRITE(VIRT_BUT_TAB2_7)
{
  short sStatus = param.asInt();
  vButLock_Set(VIRT_BUT_TAB2_7,sStatus);
}
BLYNK_WRITE(VIRT_BUT_TAB2_8)
{
  short sStatus = param.asInt();
  vButLock_Set(VIRT_BUT_TAB2_8,sStatus);
}
BLYNK_WRITE(VIRT_BUT_TAB2_9)
{
  short sStatus = param.asInt();
  vButLock_Set(VIRT_BUT_TAB2_9,sStatus);
}
short sGetLED_Index(short sSliderValue)
{
       if(sSliderValue == 1)  return 0;
  else if(sSliderValue == 2)  return 10;
  else if(sSliderValue == 3)  return 20;
  else if(sSliderValue == 4)  return 30;
  else if(sSliderValue == 5)  return 40;
  else if(sSliderValue == 6)  return 50;
  else if(sSliderValue == 7)  return 60;
  else if(sSliderValue == 8)  return 70;
  else if(sSliderValue == 9)  return 80;
  else return 90;
}

I know that i could do this using eventor setProperty setting on Blynk legacy but i read and search everything in documentation and google but nothing found.

Screenshot Blynk legacy eventor:

In automations, we only can change button state to on and off but not the property. and also i tried to use https api but only can update the mutiple pins value but not multiple pins properties.
the link for the https api documentation is also couldnt help bcs nothing is there.

My question is, is there any work around for me to get the same result as in eventor setProperty(Blynk legacy) in Automation (Blynk IOT)

Are you talking about 100 physical LEDs or 100 LED widgets?

If it’s physical LEDs then how are they connected to your hardware?
If it’s LED widgets then the free plan has a limit of 30 widgets per template, so how are you achieving 100 widgets?

Pete.

Hi Pete,

Im controlling WS812B RGB Led strip not LED widgets.
Leds are connected in series and im using FastLed library for controlling the led array.

Im not using 100widgets. im using one slider for index, and 10 Button widgets. So if slider value is 1, button widgets should display 11,12,13,14,15,16,17,18,19 and 20. and if slider value is 2, button widgets display 21,22,23,24,25,26,27,28,29 and 30 and so on…

edit:
to clarify, im using 11 widgets to control led arrays

That info should have been in your first post, along with your sketch and screenshots of your app.

Pete.

Hi Pete,

I updated my questions.

thanks

I assume that this should say V9=19 ?

I’ll wait until I see your full sketch before commenting further.

Pete.

Yes. that should say V9 = 20. bad typo. I think you get my point for this project.

Sorry for the delay. This is my first time asking questions. I already pasted my full sketch without the Blynk credentials part.

Thanks

You appear to have deleted the Blynk libraries and who knows what else.
You’d be far better replacing credentials with the word “REDACTED”.

Pete.