Why am I not able to see different coloured map markers?


Hi my manager_config.json looks like this :

{
  "loadLocales": true,
  "markers": {
  "TruckAsset": {
    "attributeName": "can_rpm",
    "showLabel": true,
    "showUnits": true,
    "colours": {
      "type": "range",
      "ranges": [
              {
                "min": 0,
                "colour": "00FF00"
              },
              {
                "min": 800,
                "colour": "FFFF00"
              },
              {
                "min": 1500,
                "colour": "FF0000"
              }
            ]
    }
  },
  "LightAsset": {
    "attributeName": "onOff",
    "showLabel": false,
    "showUnits": false,
    "colours": {
      "type": "boolean",
      "true": "6ae8fc",
      "false": "016170"
    }
  },
  "realms": {
    "default": {
      "appTitle": "GreenVision : Saarthi GreenTech",
      "styles": ":host > * {--or-app-color2: 
#F9F9F9; --or-app-color3: 
#22211f; --or-app-color4: 
#0c4da2; --or-app-color5: 
#CCCCCC;}",
      "logo": "/images/logo.png",
      "logoMobile": "/images/logo-mobile.png",
      "favicon": "/images/favicon.ico",
      "language": "en"
    }
  }
}

TruckAsset is my custom asset that i have created but the name is exactly “TruckAsset” in the file that I have created.

I have used the fleet-management repo
But my map markers remain blue

Hi has anyone encountered this error before? Still facing the issue.
Thanks in advance.

Hi!

I just checked my own configuration, and I think the format should be like this:

{
    "loadLocales": true,
    "realms": {
        ...
    }
    "pages": {
        "map": {
            "markers": {
                "MyCustomAsset": {
                    "attributeName": "myAttributeToShowTheValueOf",
                    "showLabel": true,
                    "showUnits": true,
                    "colours": {
                        "type": "range",
                        "ranges": [
                            {
                                "min": 0,
                                "colour": "00FF00"
                            },
                            {
                                "min": 800,
                                "colour": "FFFF00"
                            },
                            {
                                "min": 1500,
                                "colour": "FF0000"
                            }
                        ]
                    }
                }
            }
        }
    }
}

Hope this helps!

Hi, it still isn’t working for me:

{
  "loadLocales": true,
  "realms": {
    "master": {
      "appTitle": "GreenVision : Saarthi GreenTech",
      "styles": ":host > * {--or-app-color2: #F9F9F9; --or-app-color3: #22211f; --or-app-color4: #0c4da2; --or-app-color5: #CCCCCC;}",
      "logo": "/images/logo.png",
      "logoMobile": "/images/logo-mobile.png",
      "favicon": "/images/favicon.ico",
      "language": "en"
    }
  }
  "pages": {
    "map": {
      "markers": {
        "TruckAsset": {
          "attributeName": "can_rpm",
          "showLabel": true,
          "showUnits": true,
          "colours": {
            "type": "range",
            "ranges": [
              {
                "min": 0,
                "colour": "00FF00"
              },
              {
                "min": 800,
                "colour": "FFFF00"
              },
              {
                "min": 1500,
                "colour": "FF0000"
              }
            ]
          }
        }
      }
    }
  }
}

what I am thinking the issue is that can_rpm is an attribute I added via the GUI, meaning that in the truck asset, can_rpm doesn’t exist by default. Is that why the colour remains the same?
I have also added the map styling via a JSON generated by chatgpt which gaves rivers and landfills the colours. So is the issue?

Here is my truckasset for introspection :

package org.openremote.model.custom;

import jakarta.persistence.Entity;
import org.openremote.model.asset.AssetDescriptor;

/**
 * TruckAsset is an extension of the CarAsset class for fleet management.
 * It inherits all attributes from CarAsset and is used specifically for truck vehicles.
 */
@Entity
public class TruckAsset extends CarAsset {
    public static final AssetDescriptor<TruckAsset> DESCRIPTOR = new AssetDescriptor<>("truck", null, TruckAsset.class);

    protected TruckAsset() {
    }

    public TruckAsset(String name) {
        super(name);
    }

    public AssetDescriptor<TruckAsset> getAssetDescriptor() {
        return DESCRIPTOR;
    }
}

Do I need to add the attribute in this file for it to work?

Hey, @martin.peeters , can you take a look at this? I am still stuck.
Thanks

Hey @Saarthi, the marker “range” config will only apply when the attribute is present, has the correct type “number/integer/…” and the value matches any of the configured values.

So by default if the attribute doesn’t contain a value within any of the specified ranges it should show the label you specified with the default asset color.

image

Once you specify a value within any of the ranges you should see the color change.

image

Hello,

I’d like to join this thread and ask an additional question: is it possible to change an asset’s color on the map depending on whether there are active alarms linked to that asset?

For example:

  • no active alarms → standard color
  • at least one active alarm (open, acknowledged, in progress) → specific color

I would prefer not to use a dedicated attribute set by a rule, but instead base the color directly on the active alarms linked to the asset.

If this is currently not possible, perhaps this feature could be considered for future development? :wink:

It could potentially be extended to differentiate the color based on alarm status (open, acknowledged, in progress) and possibly also severity.

Regards,

Krzysztof

is it possible to change an asset’s color on the map depending on whether there are active alarms linked to that asset?

No this is not possible currently, nor do we have it on the roadmap of some sort.
For me personally, it would a lot of sense to add this feature to the platform.
So it’s a: “Yes please!” :+1:

Unfortunately feature requests are a bit difficult since we’re limited in resources at the moment.
Don’t know if you would be open to integrate it? Anyone can contribute this if they’d like.

I was able to modify/add code to change color of an asset with active alarms (and change back to normal color when alarms are cleared/removed) but now I’m facing problem with managing alarms on Android mobile - there’s no “alarm icon” allowing managing alarms. How can I turn it on?

EDIT:
Answering to myself: visible menu options depend on device screen width :wink: