Work on attributes (group, order, import)

Good evening, I have 3 questions about Attributes in assets that would help me a lot in the configuration:
-Is it possible to group attributes in an asset? I have some data that i receive and some data that i send, i’d like two make 2 groups of attributes in the same asset
-From the previous question, i’d like to change order of the attributes. For now i’m using the default alfabetical order with Rx and Tx at the beginning of attribute name to group them, but i need to order them like a csv that was given to me
-Is it possible to import attributes, at least the names?

p.s. i’m also having problems with attribute names, what’s the maximum length and any forbidden symbol? Can’t find it in the documentation

Thank you very much!
P

Hi P,

  1. It is possible to add/change panels that are shown on the Assets page. This can be done through the manager_configuration per asset type. Note that the admin user will not see these ‘restrictions’, but any other user will. See: User Guide: Configuring the Manager UI · openremote/openremote Wiki · GitHub the section labeled Asset - viewer
  2. Currently its alphabetical per panel
  3. Import from a csv? This can be done with a custom agent but is not very straightforward if you are new to the codebase.

p.s. we always use camelcase for attributenames. The UI shows them friendly/in sentence case in view mode. E.g. myAttribute > My attribute. Do not use symbols/white spaces.

If you would like some more help it could be useful if you explain a bit more about your use case.

Good luck,

Don

1 Like

Hi Don, thanks for your kind answer!

For the use case, i add some PLCs that send/receive data from OpenRemote, so i’d like to group attributes by sent and received. Also i’d like to order them for DB address without having to write it in the attribute name

1: I’ll try to add 2 panels for Send/Receive attributes. I wonder, when i add a new attribute where does it ask me in which panel it has to be put?
2: ok, thanks
3: Import from anything possible, i have 30+ attributes for every asset, if i could avoid to write them manually it would be a huge boost to the configuration speed

Forgot about camelcase, that’s perfect, thanks!

Hi Don
i checked the link you gave me - many thanks - but seems that i need to declare in the include which attributes I want in every panel and this means rebuilding the instance every time i set a new asset (my assets have all different attributes). Can i use some sort of wildcard - like RX* - or is there another way to group them up?

Hi,

You can actually use a wildcard indeed. "include": ["RX*"] should give you all attributes starting with RX.

Don

1 Like

Hi Don
thanks again for your help
I tried editing the json but now I have blank page. Do i need to write the full code or can i just modify the things that I need?
I edited as follows

{
   "viewer": {
        "assetTypes": {
          "ThingAsset": {
            "viewerStyles": {},
            "panels": [
              {
                "type": "group",
                "title": "underlyingAssets"
              },
              {
                "type": "info",
                "title": "location",
                "properties": {
                  "include": []
                },
                "attributes": {
                  "include": [
                    "location"
                  ],
                  "itemConfig": {
                    "location": {
                      "label": ""
                    }
                  }
                }
              },
              {
                "type": "info",
                "hideOnMobile": true,
                "properties": {
                  "include": []
                },
                "attributes": {
                  "include": [
                    "notes",
                    "manufacturer",
                    "model"
                  ]
                }
              },
              {
                "type": "info",
                "title": "Received data",
                "attributes": {
                  "include": ["rx*"]
			},
                "properties": {
                  "include": []
                }
              },
              {
                "type": "info",
                "title": "Transmitted data",
                "properties": {
                  "include": []
                },
                "attributes": {
                  "include": ["tx*"]
                }
              },
              {
                "type": "history",
                "column": 1
              }
            ]
          }
        },
        "historyConfig": {
          "table": {
            "attributeNames": {
              "optimiseTarget": {
                "columns": [
                  {
                    "header": "Optimise target",
                    "type": "prop",
                    "path": "$."
                  },
                  {
                    "header": "Timestamp",
                    "type": "timestamp"
                  }
                ]
              }
            }
          }
        }
	},
	"realms": {
    	"default": {
      	"appTitle": "IoT Portal - PCR",
      	"styles": ":host > * {--or-app-color2: #F9F9F9; --or-app-color3: #22211f; --or-app-color4: #0c4da2; --or-app-color5: #CCCCCC;}",
      	"logo": "/images/logo.jpg",
      	"logoMobile": "/images/logo.jpg",
      	"favicon": "/images/favicon.png",
      	"language": "en"
    }
}
}

Thanks!

Hi,

The way the manager config is split up on its wiki page is a bit confusing. You’re missing a bit at the start:

{
  "pages": {
    "assets": {
      "viewer": {
        "assetTypes": {
          "ThingAsset": {
            "viewerStyles": {},
            "panels": [
              {
                "type": "group",
                "title": "underlyingAssets"
              },
              {
                "type": "info",
                "title": "location",
                "properties": {
                  "include": []
                },
                "attributes": {
                  "include": [
                    "location"
                  ],
                  "itemConfig": {
                    "location": {
                      "label": ""
                    }
                  }
                }
              },
              {
                "type": "info",
                "hideOnMobile": true,
                "properties": {
                  "include": []
                },
                "attributes": {
                  "include": [
                    "notes",
                    "manufacturer",
                    "model"
                  ]
                }
              },
              {
                "type": "info",
                "title": "Received data",
                "attributes": {
                  "include": [
                    "rx*"
                  ]
                },
                "properties": {
                  "include": []
                }
              },
              {
                "type": "info",
                "title": "Transmitted data",
                "properties": {
                  "include": []
                },
                "attributes": {
                  "include": [
                    "tx*"
                  ]
                }
              },
              {
                "type": "history",
                "column": 1
              }
            ]
          }
        },
        "historyConfig": {
          "table": {
            "attributeNames": {
              "optimiseTarget": {
                "columns": [
                  {
                    "header": "Optimise target",
                    "type": "prop",
                    "path": "$."
                  },
                  {
                    "header": "Timestamp",
                    "type": "timestamp"
                  }
                ]
              }
            }
          }
        }
      }
    }
  },
  "realms": {
    "default": {
      "appTitle": "IoT Portal - PCR",
      "styles": ":host > * {--or-app-color2: #F9F9F9; --or-app-color3: #22211f; --or-app-color4: #0c4da2; --or-app-color5: #CCCCCC;}",
      "logo": "/images/logo.jpg",
      "logoMobile": "/images/logo.jpg",
      "favicon": "/images/favicon.png",
      "language": "en"
    }
  }
}

Could you try this one?

Don

1 Like

edited: It works now for the attributes many thanks!
However. if i write an attribute that doesn’t begin with any of rx* or tx* it doesn’t show. Should i make a new panel like “generic” and include [*] ?

Yes you could make a new panel that excludes all the rx* and tx*, so all others are automatically included.

1 Like

Hi Don, it’s me again
I didn’t open a new topic because it’s still related.
My assets have tons of attributes, different every asset.
Is there a way to import a json/csv/anything to the instance to automate the creation of a full asset?
Something like:

ThingAsset{
        name=asset1
        parent=parent1
        attributes{
                 attribute1{
                 storedatapoints=true
                 label='label1'
                 }
       }

any way i can do this? I’d like to write some code to automate this process and preformat everything so I can just take the file and upload it to OpenRemote

Thanks in advance!