Sensors in map with colour status

Hello,

Is it possible to show the status of the sensors on the map using colors, for example if there are sensors that are offline they appear in red and if there are sensors that are online they appear in green? just to know quickly which sensors have stopped working

Thank you

Regards

Indeed you can.

Here is the mapconfig wiki

Just make an Boolean attribute with „Online“
Your Sensor sends a true, when it’s online and just send a lastwill with false, if the sensor is gone offline.

1 Like

Do I have to define the boolean attribute “Online” in manager_config.json, right?

In which block should I add it? Because I am testing but I cannot modify the color of the assets according to their status.

{
  "pages": {
    "map": {
      "card": {
        "default": {
          "exclude": [
            "notes"
          ]
        },
        "assetTypes": {
          "WeatherAsset": {
            "exclude": [
              "location",
              "notes",
              "model",
              "manufacturer"
            ]
          }
        }
      }
    },


        "markers": {
  "online": {
    "attributeName": "online_test",
    "showLabel": true,
    "showUnits": true,
    "colours": {
      "type": "boolean"

    }
  }
},


    "rules": {
      "rules": {
        "controls": {
          "allowedLanguages": ["JSON", "FLOW", "GROOVY"],
          "allowedActionTargetTypes": {
            "actions": {
              "email": [
                "CUSTOM", "USER"
              ],
              "push": [
                "ASSET", "USER"
              ]
            }
          }
        },
        "descriptors": {
          "all": {
            "excludeAssets": [
              "TradfriLightAsset",
              "TradfriPlugAsset",
              "ArtnetLightAsset"
            ],
            "assets": {
              "*": {
                "excludeAttributes": [
                  "location"
                ]
              }
            }
          }
        }
      }
    },
    "insights": {
      "dataViewer": {
        "panels": {
          "chart": {
            "type": "chart",
            "hideOnMobile": false,
            "panelStyles": {
              "gridColumn": "1 / -1"
            }
          },
          "kpi1": {
            "type": "kpi",
            "hideOnMobile": false
          },
          "kpi2": {
            "type": "kpi",
            "hideOnMobile": false
          },
          "kpi3": {
            "type": "kpi",
            "hideOnMobile": false
          },
          "kpi4": {
            "type": "kpi",
            "hideOnMobile": false
          },
          "kpi5": {
            "type": "kpi",
            "hideOnMobile": false
          },
          "kpi6": {
            "type": "kpi",
            "hideOnMobile": false
          },
          "kpi7": {
            "type": "kpi",
            "hideOnMobile": false
          },
          "kpi8": {
            "type": "kpi",
            "hideOnMobile": false
          },
          "chart2": {
            "type": "chart",
            "hideOnMobile": false,
            "panelStyles": {
              "gridColumn": "1 / -1"
            }
          },
          "chart3": {
            "type": "chart",
            "hideOnMobile": false,
            "panelStyles": {
              "gridColumn": "1 / -1"
            }
          },
                  "chart4": {
            "type": "chart",
            "hideOnMobile": true,
            "panelStyles": {
              "gridColumn": "1 / -1"
            }
          },
                  "chart5": {
            "type": "chart",
            "hideOnMobile": true,
            "panelStyles": {
              "gridColumn": "1 / -1"
            }
          },
                  "chart6": {
            "type": "chart",
            "hideOnMobile": true,
            "panelStyles": {
              "gridColumn": "1 / -1"
            }
          },
                  "chart7": {
            "type": "chart",
            "hideOnMobile": true,
            "panelStyles": {
              "gridColumn": "1 / -1"
            }
          },
                  "chart8": {
            "type": "chart",
            "hideOnMobile": true,
            "panelStyles": {
              "gridColumn": "1 / -1"
            }
          },
                  "chart9": {
            "type": "chart",
            "hideOnMobile": true,
            "panelStyles": {
              "gridColumn": "1 / -1"
            }
          },
                "chart10": {
            "type": "chart",
            "hideOnMobile": true,
            "panelStyles": {
              "gridColumn": "1 / -1"
            }
          }
        }
      }
    },
    "assets": {
      "tree": {
        "add": {
          "typesParent": {
            "default": {
              "exclude": [
                "TradfriLightAsset",
                "TradfriPlugAsset",
                "ArtnetLightAsset",
                "ArtnetAgent",
                "MacroAgent",
                "ControllerAgent",
                "KNXAgent",
                "ZWAgent",
                "TradfriAgent",
                "TimerAgent",
                "VelbusTcpAgent",
                "VelbusSerialAgent"
              ]
            }
          }
        }
      },
      "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": "Weather data",
                "attributes": {
                  "exclude": [
                    "location",
                    "radiation",
                    "rainfall",
                    "uVIndex",
                    "currentWeather",
                    "notes",
                    "manufacturer",
                    "model"
                  ]
                },
                "properties": {
                  "include": []
                }
              },
              {
                "type": "info",
                "title": "Extra details",
                "column": 1,
                "properties": {
                  "include": []
                },
                "attributes": {
                  "include": [
                    "rainfall",
                    "uVIndex"
                  ]
                }
              },
              {
                "type": "history",
                "column": 1
              },
              {
                "type": "linkedUsers",
                "column": 1
              }
            ]
          }
        },
        "historyConfig": {
          "table": {
            "attributeNames": {
              "optimiseTarget": {
                "columns": [
                  {
                    "header": "Optimise target",
                    "type": "prop",
                    "path": "$."
                  },
                  {
                    "header": "Timestamp",
                    "type": "timestamp"
                  }
                ]
              }
            }
          }
        }
      }
    }
  },


         "realms": {
    "default": {
      "appTitle": "IoT",
      "headers": [
        "map", "assets", "rules", "insights", "language", "users", "roles", "account", "logs", "logout"
      ],
      "styles": ":host > * {--or-app-color2: #F9F9F9; --or-app-color3: #22211f; --or-app-color4: #1b5630; --or-app-color5: #CCCCCC;}",
      "logo": "/images/logo.png",
      "logoMobile": "/images/logo-mobile.png",
      "favicon": "/images/favicon.png",
      "language": "en"
    },
    "test": {
      "appTitle": "test IoT",
      "styles": ":host > * {--or-app-color2: #F9F9F9; --or-app-color3: #22211f; --or-app-color4: #275582; --or-app-color5: #CCCCCC;}",
      "logo": "/images/logo.png",
      "logoMobile": "/images/logo-mobile.png",
      "favicon": "/images/favicon.png",
      "language": "en"
    },
    "prueba": {
      "appTitle": "Prueba IoT",
      "styles": ":host > * {--or-app-color2: #F9F9F9; --or-app-color3: #22211f; --or-app-color4: #275582; --or-app-color5: #CCCCCC;}",
      "logo": "/images/logo.png",
      "logoMobile": "/images/logo-mobile.png",
      "favicon": "/images/favicon.png",
      "language": "es"
    }
  }

}

Hi,

First off, just make sure your looking at the map as a different user than the admin user. Because the admin won’t see the changes to the map markers by the manager_config (yes, that is a bit confusing).
The part about the map markers should look like this, assuming your asset type is called CustomAsset:

 "pages": {
    "map": {
      "markers": {
        "CustomAsset": {
          "attributeName": "online_test",
          "showLabel": true,
          "showUnits": false,
          "colours": {
            "type": "boolean",
            "true": "ef5350",
            "false": "4caf50"
          }
        }
      }
    },...

great it works now thank you very much Don.
Can only modify assets? Or can agents also be modified in the same way?

You’re welcome!

Just to be clear, you’re not modifying assets, you’re configuring how the map colours its markers based on attribute values of an asset type.
Agents also have an asset type (and are assets) so the styling of their markers on the map can also be determined with the manager_config.

Don