[Solved] Device tag as dashboard context string



My devices all have a tag called “Site”.

If I use https://app.losant.com/dashboards/5aa32cbcf45d3f00075f9488?ctx[deviceId-0]={{deviceId}}&ctx[string-0]={{deviceTags.Site}} as the URL for a device list node on a dahsboard, the URL it generates always has an empty string for string-0.

If I use https://app.losant.com/dashboards/5aa5ecbcf45d3f00075f9488?ctx[deviceId-0]={{deviceId}}&ctx[string-0]={{deviceName}} it works correctly.

Any ideas?



The way to get the deviceTag Site onto the URL, would be like {{ valueByKey deviceTags 'Site' 'key' 'value' }}. It is a little confusing but deviceTags is actually an array of objects, e.g. [{ "key": "Site", "value":"foo" }]. We will add a better example at the bottom of that Device List Block, that explains how to access the device tags. These URL helpers can be found at in our docs on the access payload data page.

Hope that helps,



Thanks Erin. I always forget that valueByKey thing. So many times I have forgotten that!