I have a request to allow Input Controls to reference Tags, instead of only attributes.
In our application, our workaround is to write the current value of some tags to attributes on the payload to display dynamic values on input controls. While this duplicates data unnecessarily, it also causes a slight issue between the time of the tag being set, and the next time the device state is set. (The last attribute value is the old value, not the new tag value, until the workflow runs and sets the attribute to the tag value).
You already can use tags in input control blocks, provided you are utilizing dashboard context.
See the attached screenshot. This comes from a dashboard that utilizes a device ID context variable that also returns the full device object (illustrated by printing out the value in the help block). You can then reference the values of those tags in the input controls configuration, illustrated here by the min, max, and default values for the range slider component.
If there is some other use case that this doesn’t solve please let us know.
Thanks @Dylan_Schuster,
Let’s say I am setting a recipient email address as a tag.
I then want to use the text input block, with a dynamic value, to show me the current email address (tag).
Is this possible?
I think I may have misunderstood.
I will try the Static value now.
Thanks @Dylan_Schuster,
That’s exactly what I was looking for!
Hi @Dylan_Schuster,
This tag behaviour is working well for the text fields.
How does this apply to something like a toggle?
Is there a way to set the static value of a toggle, by using a context tag?
Many thanks,
For a toggle switch, that workaround I proposed will not work. Best I can come up with is if the tag’s default value is set as “1” or “0”, and you instead use a shrunken Range Slider input, min 0, max 0, step 1. Not the best but would get the job done.
@Dylan_Schuster This solution has been working for me, but isn’t reliably populating the boxes within the input controls widget.
Sometimes the referenced tags will be visible in the boxes when the page loads, but often the boxes will be empty until the page is refreshed. Sometimes the page has to be refreshed multiple times before the boxes populate.