How to reference device name in a Section Header

I’m adding a Section Header to my dashboard, however I am unsure on how to reference the device name for it to show when selecting a certain device. If I use ‘{{ctx.deviceId-0}}’ as the Block Header text, it does show the correct device ID, but this is not what I’m needing. I’ve tried searching through the forms, and also read over the context variable page (https://docs.losant.com/dashboards/context-variables/), but I’m either not understanding, or just not seeing it.

Hi @Emory_Clayton, and welcome to the Losant Forums.

Assuming you have checked the box in the device ID context variable to Include full device info in context, you can reference the device name through the template {{ctx.deviceId-0.name}}.

Pro tip, when I am developing a dashboard, I like to put the following into the dashboard description, minus the \ characters, which I need to include here to escape for rendering in this reply:

\```
{{jsonEncode . 2}}
\```

This prints out at the top of the dashboard all the values I have available to me in rendering names, values, etc.

Let us know if you have any other questions, and again, welcome to Losant!

1 Like

Thank you for your response. That is what I was looking for!