Looking for a Virtual Custom Attribute Device type thing or something similar

Does anybody know of anything like a custom device that has user configurable attributes which can be set with custom values?

For example, a device with absolutely no actual functions. Just a virtual device that can have any number of custom attributes assigned to it so you can store whatever information you wanted to in those attributes and then access them in other places (Rule Machine, Attribute tiles on dashboard, the multi-attribute tile maker, etc)

Attribute names cannot be dynamically defined in a driver. You'll have to write (or use) a custom driver that has the exact specific attributes (name, type, and number of them, etc.) you need.

You also have to consider where is the information coming from. If the information already exists somewhere does it make sense to make a second copy of it unless you are doing some interim operation.

I think the closest thing to what you are looking for is Hub variables.

4 Likes

I have a whole bunch of information saved to Hub Variables and I'm trying to consolidate that info into a useful tile using Tile Builder, but it only seems to support attributes and not hub variables... Unless I missed something.

So what I was hoping for is a random device where I could make a bunch of empty attributes and fill them with the hub variables info.

If you want to use hub variables you can. You just need to connect them to a device as shown.

1 Like

They don't need to be useful attributes for anything else really. I'm thinking like a device with only a few properties:

  1. How many attributes? Maybe a possible range of up to 25.

That's it.

Each attribute would just be "attribute1", "attribute2", and so on... You could fill the attributes with info via Rule Machine using strings or Hub Variables data, and then use those attributes to build tiles with Tile Builder.

I do not have the faintest idea how to write groovy code, but maybe it's time for a project...

I think what @garyjmilne described in creating devices linked to Hub Variables may be what you are looking for, though your comment on:

may make it a little cumbersome to manage in separate devices.

If you want to go down the route of writing a driver, you may be interested to look at some code I wrote to allow me to record generic attributes via calls to Maker API.

You could expand the code to include more of one or all attributes. That said, I only named the attributes the way I did because I was wanting to re-use the driver in different situations and make the driver available for others to use. If you are writing a driver to suit your own need, then you could name the attributes as you wish.

Yeah separate devices would make this a pain. I came up with 25 arbitrarily, but I feel that would be more than enough for any uses I had in mind.

The main motivation for this is 2-fold:
1- Hub Variable tiles do not update properly when using remote dashboards, which makes information on tiles potentially out of date
2- Tile Builder doesn't seem to be able to receive info from Hub Variables to build tiles with.

I am definitely going to take a deep look at your device code and see if I can figure out how to make my own driver to fulfill this purpose. Thanks for sharing!

1 Like