I need to add a layer of security to my slider. Simply put, before setting the new value to the slider
via the blynk app, i need the app to ask for the username and password, which can be written on a terminal widget and after verifying the information will the slider change its value. Can this be done ?
It cant be done easily, or exactly as you’ve described, but there are ways of working around the issue in code…
Store the last ‘verified’ slider value as a variable in your code.
When the slider value changes in the app it will trigger the BLYNK_WRITE(VPin) function for the virtual pin that the slider is attached to
Use the BLYNK_WRITE(VPin) trigger to write text to the terminal widget requesting a username and password. You could also start a timeout timer, which would restrict the amount of time available to the user.
When the username and password are received, if they match the hard-coded credentials then update the ‘verified’ value stored in the variable and do something with it in your code, clear the terminal and tell the user that the change was successful. Otherwise write the last verified value back to the slider widget, so that it resets to its previous value.
If you went for the timeout timer option and no valid username and password were received before the timeout is reached then reset the slider, clear the terminal and tell the user that the change was unsuccessful.
You can do this with the help of terminal to enter a password to activate the slider
Unfortunately, that’s not true, as it’s not currently possible to deactivate widgets via code (or via any other method for that matter).
You could get the user to enter their username, password and new value for the slider in terminal, then update the slider. However, any changes to the slider would make it appear that a different slider value was currently being used. You’d have to overcome this by writing the old value back to the slider every time it was changed manually.
Nothing is impossible
But it will not be exactly as you imagined
Yes this can be done. But would have to be in code on the device running Blynk.
You would need to check the last set value of the slider against then new slider value and if it was different then request the username/password etc.
This would not deactive the widget but would stop your device running code until authentication is complete.
What device are you running your Blynk app on?
The code is running on Particle photon.
Did you get this worked out?
I managed to write a code, where the terminal widget is waiting for a password and if its correct, then a variable writecomand would change from 0 to 1 and if its 1 then in the slider’s code, the value can be changed, and after changing i added a button to send the new value for further processing as needed. The code works very well.
Glad you got sorted.
BTW, this feature is ready in the new Blynk version… Just saying
Something like that?
You could replace lock button by enter login and password using terminal widget to unlock sliders.
As in ready for us to find it in the settings (which I haven’t yet), or ready for it to be released?
Not yet released. Part of the brand new Blynk platform version we are working on.