Utilising device tag for Expression

Hi Losant Support,

I’m hoping to understand whether or not is possible to access the value of a device tag for the purposes of using the tag to control the formatting of a time-series.

My specific example relates to the transformation of a distance to a percentage fill without use of a supplementary workflow to create a new attribute through the time-series expression feature:

I’m struggling to access the device tag values associated with the min and max fill points for a container which are stored are associated with the device. In this example, the device is being accessed as a context variable ({{ctx.deviceId-0}})

Is it possible to access tag values for the expression? If so could I please be provided a basic handlebar snippet to assist with using this feature?

Thank you!
Ben
PiP IoT

@Ben_Sinclair,

Hello :wave:

When setting up your device context variable, you have the option to choose “Include full device info in context.” This will add more info about that device to your context variable (like Device Tags).

Then, given the tag min, from within your expression, you may access the tag like so:

{{ctx.deviceID.tags.min.[0]}}

Relevant Resources:

Context Variable Documentation
Losant University - Course Four - Context Variables

Hi Taron,

Thanks for your reply - this solved my issue!

Kind regards,
Ben