Add device attribute tag through workflow

Hello,

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.

Thanks,
Jonathan

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:

image

In my Virtual Button, I added the following:

{
   "newAttributeTags":{
      "attributes":[
         {
            "name":"temperature",
            "dataType":"number",
            "attributeTags":{
               "unit":"celcius",
               "threshold":"50"
            }
         }
      ]
   }
}

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?

@Jonathan_Betke,

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.

image