pabou
January 24, 2024, 9:36am
1
Is there a way to change a button TEXT (ie what is written in the center) programatically with a python api.
I can change the color and label
The context is that this button is used to control a ressource, which is also controlled by another mean. When using this other lean, I would like to update the button on the Gui accordingly.
Thanks
Hello @pabou . You can change TEXT in Button widget via Label properties.
Blynk.setProperty(V1, "onLabel", "ON");
Blynk.setProperty(V1, "offLabel", "OFF");
or via HTTP API
https://blynk.cloud/external/api/update/property?token={your 32 char token}&pin={your vPin}&onLabel=newtext
https://blynk.cloud/external/api/update/property?token={your 32 char token}&pin={your vPin}&offLabel=newtext
For example:
https://blynk.cloud/external/api/update/property?token=GVki9IC70vb3IqvsV0YD3el4y0OpneL1&pin=V0&offLabel=noValue
Please read Button - Blynk Documentation
def set_property(self, pin, prop, *val):
self._send(MSG_PROPERTY, pin, prop, *val)
Also post about update properties via Python
@Doom_guy Old Blynk Python support was very basic, but here is what you need to look at to figure it out…
As far as I recall with RPi/Python/Blynk there was no direct GPIO control, all that is done with vPins and whatever Python GPIO library you chose to use.
Instructions are minimal, and there are some limited examples in the Blynk Python library. But nothing I could see on how to properly use set_property so you will have to look into the library and compare/extrapolate it for yourself…