How to add custom asset type to project

Hi there,

I tried to add custom asset type (asset with custom measured values and predefined attributes, as example asset type for heat pump). I added the definition for my custom asset to:

/openremote/modul/src/main/java/org.openremote.modul/apps/asset/AssetType.java as new AssetType

On build this generates custom asset definition in

/openremote/ui/component/modul/src/index.ts as a new AssetType();

When I load the newly compiled project to manager, custom added asset is not visible.

Where else do I need to define the custom asset to be usable in my custom project?

Probably this is not the right way to add a custom asset type (with modifying original OR code) for my custom project - what and how would be the right way to add a custom asset type only for specific custom project?

BR

AssetTypes are discovered by the backend at runtime via the AssetModelProvider interface; the built in DefaultAssetModelProvider retrieves all the AssetDescriptors defined in the AssetType.java enum so if you added a new AssetType in there and you recompiled the manager (if using docker images then obviously you would need to rebuild the manager docker image:

  1. ./gradlew clean installDist
  2. docker-compose build manager

There is a REST endpoint that the frontend uses to retrieve the available AssetDescriptors which is provided by AssetModelResource which assuming the manager is running on https://localhost:8080/and you are logged into the smartcity realm would resolve to http://localhost:8080/api/smartcity/model/asset/descriptors.

You can use Chrome dev tools to inspect the response from this endpoint or if you are running inside an IDE in debug then put a breakpoint in AssetModelResourceImpl.