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

Dynamic (enable/disable) widgets?

Is there a way to enable/disable a widget in dashboards from Device?

Background
New Blynk IoT seems to be designed to handle lots of Devices to be added “by end user”. Each such device then “same”, defined by a Device Template.

Question:
If you provide “configurable devices”, think " with sensor add-ons", is there any way to enable/disable sensor widgets from Device in the dashboards in app and web?

A Device would at start up, and maybe regularly, detect added HW and enable those widgets related to this HW/datastream.
This could also be used to provide a function to indicate a non-working sensor by disabling the widget so “false/old” data is not displayed.

Is this possible today?
If not, would it be an interesting feature to add? To enable/disable a widget from Device.

Jonas

All app widgets now have a isDisabled property which can be set/cleared via the SetProperty command.
This doesn’t hide the widget, it simply disables it.

It sounds like you need to clone your template and make some minor changes to it, then use this as the basis for your alternate devices.

Pete.

Aha, Thanks. I’ll look this up.

For me, disabling, would he great if this is in someway indicated/visible to the user. My use-case is more to indicate “Warning, this sensor data is old, and therefore unvalid”.

If “disabled” is indicated like a dimmed out widget or similar, this is good for me.

(In my current Legacy apps, I use LEDs to light up in red whenever a data is “old” (typically no report in 2.5 times the normal poll time.). Reason is, of course, not to display an old temperature which is not valid anymore. I also then Change the data values to “–” which seems not to work well in new Blynk IoT which seems to set a default value if data is out of range. (Due to stricter datastream handling?) And this does not work well with my strategy to indicate “undefined data”.
I might have misunderstood or not tested enough yet …)

Anyway, my goal is to clearly indicate “undefined sensor data” in best way.

OK, seems Blynk IoT have introduced a feature for me … Invalidating Data.
It is possible to set a timeout until a datastream value is invalidated in the DataStream definitions. That is exactly what I want and need. +++

I first tried the isDisabled property but I didn’t get it to work. I only tested once before I found the new invalidate thing so I never even debugged my own code. So that might work as well. I don’t know.

Instead, I switched to the new (?) Invalidate Data under Advanced Settings in the Datastreams page. And this is the thing I want. Great.

However, it seems either buggy or unclear how it shall function.
It seems to invalidate data after said time, but it is not always reflected (updated) in the views/dashboards automatically.

Web Dashboard: It seems not to be updated automatically, only on entry and page reload.
Mobile: Not sure, but seems to be updated on entry.
Mobile Dashboard: Never gets updated.

This might be due to my test conditions. The temp value (I tested with) is updated once every 60 secs. I set the Invalidate (Temp) Data to 10 secs.
This is of course unrealistic “to frequent” and there might be fully reasonable delays in this mechanism. It may very well work in real use where I would have “data/temp update every 5 mins” and “invalidate time of 15 mins”. If that works, I am happy.
I will test more.
But this function is good as it is a must if you are to rely on presented data. And you should …

Jonas

isDisabled works, it is used by few big clients.

Yes. The view is updated only when you open the app and not in real-time. However, we already fixed it, we just haven’t enabled this feature in the blynk cloud. Will do with the next deploy. Stay tuned.