Blynk.getProperty (vPin, "property")

Всім привіт!

Є така чудова функція, як Blynk.setProperty(vPin, “property”, value);
Було б чудово як би в бібліотеці з’явилась в додачу ще й функція Blynk.getProperty(vPin, “property”);

Пояснюю для чого:
В проекті є декілька пристроїв. Один з них показує показники на TFT Display, зняті іншими пристроям (температура, вологість, освітлення, тощо). Ці показника мають кожна свою назву (label). Зараз, щоб задати назву якомусь показнику мені потрібно: встановити назву (label) віджету в додатку, плюс внести зміни в firmware і назвати так само цей показник в програмі, яка працює на пристрої з TFT Display. А хотілося б щоб я, змінив чи задав назву (label) віджету у додатку, а програма, яка працює на пристрої з TFT Display використовуючі функцію Blynk.getProperty(vPin, “property”); отримувала назву віджету і вставляла в потрібне місце на цьому TFT Display автоматично, без зміни firmware, кожного разу коли міняється назва (label) віджету.


Hello everybody!

There is such a great feature as Blynk.setProperty (vPin, “property”, value);
It would be great if the library appeared in addition to the function Blynk.getProperty (vPin, “property”);

I explain for what:
There are several devices in the project. One of them shows indicators on TFT Display taken by other devices (temperature, humidity, lighting, etc.). These indicators have their own label. Now, to name a certain value, I need to: set the label of the widget to the application, plus make changes to the firmware and name it as an indicator in the program running on the device with TFT Display. But I would like to change or name the label in the application, and a program running on a TFT Display device using the Blynk.getProperty (vPin, “property”); function got the name of the widget and inserted it in the right place on this TFT Display automatically, without changing the firmware, whenever the label name of the widget changes.

2 Likes

@taburyak not entirely sure what you want to do but it can probably be done with a combination of the menu and terminal widgets.

@Costas Yes, you probably can do this. But these are not comfortable bones. I do not like this.

@taburyak there is actually the workaround. You may just do any write via virtualWrite() and get it via syncVirtual.

Example:

Blynk.virtualWrite(V1, "labelForLabel");
Blynk.setProperty(V1, "label", "labelForLabel");

Blynk.syncVirtual(V1); //"labelForLabel"
1 Like

@Dmitriy ні це не те. Тут ініціатор зміни назви віджету пристрій. І зміна назви віджету передбачає зміну firmware. А якщо назву віджету я задам на смартфоні у додатку? Як пристрою взнати цю назву?
мені потрібно щось на кшталт:

neither is it. Here the initiator of changing the name of the widget is a device. And changing the name of the widget involves changing the firmware. And if I name the widget on my smartphone in the app? How does the device know this name?
I need something like:

string lbl = Blynk.getProperty(V1, "label");
tft.print(lbl);

Оце було б чудово.

That would be great.

Do you need to change labels often? You could use the terminal to type in a new label name with Vpin designation (separated by comma perhaps), then have some code that takes that data and update both the appropriate widget’s label and the TFT display.

I am not feeling clearheaded enough to figure out the proper string handling commands but basically along these lines:

Enter "V1,mynewlabel" on terminal 

BLYNK_WRITE(V1) // Terminal Input Function
{
  String Termtext = param.asStr();
  // separate text before comma (vPin) and after comma (newLabel)... might have to convert string vPin to something else... int, char...??
  Blynk.setProperty(vPin, "label", "newLabel");
  tft.print(newLabel);
}

@Gunneryes, yes, this way it can be realized. I do not want to change the names of widgets often, but I want to have a universal firmware for a device that is comfortable to use. The terminal makes it difficult to use a fairly simple device.

так, в такий спосіб це можна реалізувати. я не хочу часто міняти назви віджетів, а хочу мати універсальну прошивку для пристрою, яким зручно користуватись. термінал ускладнює користування доволі простим пристроєм.

Not really… hide terminal in back tab, and just type and hit enter… (of course you will need to know the vpin in question).

…as opposed to stop project click on widget to edit, edit label, click off, start project, wait for another widget button press or something to tell sketch to scan for label changes; Because doing so automatically i.e. constant Blynk.getProperty(Vx, "label"); reads will take much more bandwidth and processing for a relatively rare use case.

@Gunner , in general, I agree with you. but still, the terminal, that’s not what suits me.

Until the developers release another text entry widget (apparently planned) that is our only text entry option… and can easily be swapped out later.

Besides… the Server does NOT scan and check for Widget property values and changes… so even if you did have such a command, you still need to program and activate the code to make the change… so unless you want the server to literally scan all vPins for any changes each time you make one and push that update to the server for later sketch update (not a good idea - imagine the overhead), you would still need to enter some form of data to manually update the sketch to know what vPin label to change… and that brings us back to Terminal.