Add device attribute tag through workflow


Looking for an easy way to simply add an attribute tag through a workflow triggered by a post request to save device settings. I already have a post workflow, just need to add this part*

The tag will house UI info for a piece of data. The tag will be used by the DOM on the (custom) device dashboard and display the data as a water tank, gauge, or simple text based on the user preference.


Hi @Jonathan_Betke,

Yeah, this one is a little weird to update in a workflow. Here is an example for you:

I have a device with two attribute tags:

In this example, I’m using tags to store units and an attribute-specific threshold.

Here is an example workflow that updates both of these:


In my Virtual Button, I added the following:


I crafted the following using the Device Patch Schema.

Then, using the Device: Update Node, we can update the tags. The special part here is that you’d have to use the “Payload Path” option. ( There is a current ticket to make updating these easier in the node. I’m going to +1 that. )

Important: You must update all tags, even if you’re only updating just one.

I know this is a small workflow, but here is an export for you:

set-attribute-tags-develop.flow (2.0 KB)

Let me know if you have any questions :slight_smile:

All tags on the entire device, or just the attribute?


This would be all tags, and their respective attribute tags.

@anaptfox - Could you +1 that other ticket for me like 57 times :wink: It shouldn’t be this hard to change one attribute tag through a workflow.

Although it would be proper in my opinion to put the associated UI tags to each attribute they belong, I decided to add them to the device tags as that is supported through simple workflow Device Update node.


If you are attempting to use this method to update tags of an attribute, do you have to update all tags of just that single attribute, or do you have to update all tags of all attributes?

Hello @Edward_Cline,

This would be all tags on the device, with their respective attribute tags.

Thank you,

Thanks for the quick reply Heath. I would agree fully with Jonathan above that it shouldn’t be this hard to change one attribute tag through a workflow. In addition, this is truly dangerous…if you have a device with 50 attributes and make one small validation error in your device patch JSON you could easily delete an attribute (and I assume the complete data storage of its history over time?) which could be a disaster if that history data is relied upon for a critical measurement or documentation.

Having UI tags in the attribute is the proper place for them as they are used to describe that piece of data, however, there really has to be a better way to update them programmatically and safely. Is it possible someone at Losant could put together a custom node that would provide a bulletproof way to update (but not delete) an attribute tag using the payload path and device patch schema? Without a safe and easy way to change attribute tags they are not very useful.

Fair point, and we’ll look into some easier ways to update a single attribute tag through the Device: Update Node.

Here’s another way that you may find easier to use: The bulk device update API endpoint supports adding, editing, or removing attribute tags one at a time. So instead of using the Device: Update Node, you could use the Losant API Node targeting the Devices: Patch resource/action. Demonstration workflow is attached.

The downside is that the bulk edit operation does not include the updated device(s) in the response, hence the Device: Get Node following the Losant API Nodes so that you can get the device with the updates applied.

update-attribute-tag-develop.flow (4.4 KB)