Styled button switch mode only works after assigning datastream

This is just a minor bug, but on my iPhone XR 15.5, the Styled Button’s Switch mode instead functions as in Push mode. The same applies for Button. The way to get both Switch mode’s to act like switches is to first assign a Datastream. Then after removing the datastream, it will still function like a switch.

The issue is that mode can be applied only after “correct” setup order or do you expect some exact behavior from the widget with no Datastream assigned?

The behavior of the widget I was expecting before Datastream is assigned is that the Switch mode would function as a switch, but it instead functions as a Push button.

Well, the widgets are supposed to work with the datastreams assigned.
Otherwise, what’s the use of in them?
If you want the button to make no action and to be just a UI flag or something, you can create and assign the virtual pin that won’t be used in the firmware.

Unlike Blynk Legacy, the Min/Max values assigned to a datastream are used in the widget.

For example, in Legacy the LED widget used a value of 0 for off, 255 for on at maximum brightness, and intermediate values for varying brightness, so 127 would be half brightness.
If you set-up a datastream with a minimum value of 0 and a maximum value of 255 in Blynk IoT and assign it to an LED widget then you’ll get exactly the same behaviour.

However, you can also use 0 and 1 in the datastream, and 0 will be off and 1 will be on at maximum brightness.

Or, you could go the other way and assign 0 to 1,000,000 as your datastream range, and that would give 500,000 as the half brightness value for the LED widget.

The point is that the widget doesn’t know how to behave until it has a datastream assigned to it, and that’s the root cause for the behaviour you’re seeing.
Blynk could force you to assign a datastream before existing edit mode, but that would force you to work in a particular way, which wouldn’t suit everyone in every situation.


1 Like