BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Read button labels (and other widget properties)

#1

I’ve a project where I’ve defined a button to turn on/off relays. I also have a timer widget for the same relay to be turned on/off on schedule. I want the labels for the two widgets to be synchronised. I know I can do Blynk.setProperty() to set the label. How do I read a label? Could not find any example anywhere.

If the user sets the label on either the timer or the switch, the other must change automatically. How do I achieve this?

0 Likes

#2

You don’t need to read labels, just set both with two setProperty() calls.

0 Likes

#3

@Costas. I do that right now. This does not handle the situation I had in mind. Actually right now, I’ve an internal command that the user can execute via the terminal. S1 “string”. This changes both the labels.

If the user were to change the label from the UI, this would fail. Want to cover that case.

0 Likes

#4

@mohan_sundaram setProperty() is a one way process… there is no present way of reading back any widget’s properties, excepting it’s vPin data. Nor is it a practical option as far as I can see. You can store ‘labels’ in arrays, in your sketch, and probably track which one is ‘current’ that way.

0 Likes

#5

This is not a deal breaker but good product cosmetics. I’m sure the label data is available on the Blynk server. I wish there was some way of reading widget properties. I would use it to read the TZ of the RTC widget…:slight_smile:

0 Likes

#6

I changed your topic to a ideas one… perhaps the developers will see it (besides, I think it has been requested before anyhow :wink: )

0 Likes

#7

I thought you were referring to a user changing the labels via code with a running project, not by stopping the project and editing the labels themselves.
I can see this would be useful but real apps don’t allow the user to make these kind of changes because if you allowed it they could also delete all the useful widgets by mistake etc. So they can only be changed by code in a published app or you would share a project so a user can’t destroy the project.

0 Likes

#8

@Costas. My application is to control 4 relays (and so switches) at home. I’m assuming if we package an app using blynk.io, the button labels can be edited. The user should be able to say Light/ Fan/ AC/ Heater etc. I was not sure and so gave commandline for that in the terminal. If the user cannot edit the label in the app, I’m safe. Most apps do give that feature of editing button legend/labels. Eg eWeLink

0 Likes

#9

No, users of published apps can only change labels with code that you write (Terminal / Menu etc).
If you don’t want to do the coding yourself I’m sure Blynk has a package that would do it for you.

And Blynk does too, Terminal / Menu etc. eWeLink is nothing like Blynk.

0 Likes

#10

I’ve coded it myself. YOu would see it in my code in my other reply for “reboot using terminal” thread.

0 Likes

#11

I love Blynk, a boon for a newbie like me and let there be no doubt on that please. When I say a feature is available in another package, I’m not placing it higher in capability as compared to Blynk. In the home automation space, the feature of editing button legend by the user is an important one. I sensed it may not be available in Blynk and coded it in my terminal section.

0 Likes