Asset Attribute with JSON Object and store data points to Line Chart

Me again :wave:

I was looking into the doc now for creating default dashboard for users and first noticed I could not select my device for a dashboard.

Quick search lead me to User Guide: Manager UI · openremote/openremote Wiki · GitHub where its described I need to add Store data points. Fair enough.

But when I select the Attribute with the JSON Object the Line Graph loads for ever.
Understandable since how should the line graph know which json path to render. At least this is what my head tells me.

I must be missing something :thinking:
How can I create a Dashboard with Data from a JSON Object?
Somehow I need to configure the graphs to show either JSON Paths or something.

Hi Birdie,

We’re adding a filter to the asset attribute picker so you can’t select an attribute with a valuetype that does not match the widget anymore. So that should solve your initial confusion :slight_smile:

Secondly, if you are getting the data using an Agent Link, you can filter the JSON with a value filter so that you only write the value that you need, not the whole object, to the attribute. However, I believe you are using the MQTT API, so you could do the following:

  • Write the JSON to an attribute ‘A’
  • Add the attribute link configuration item to that attribute to push a filtered value to another attribute ‘B’
  • Unfortunately the attribute link does not have a nice form UI yet, so you will have to it like this:
[
  {
    "ref": {
      "id": "ASSET_ID",
      "name": "B"
    },
    "filters": [
      {
        "type": "jsonPath",
        "path": "$.main.temp",
        "returnFirst": true,
        "returnLast": false
      }
    ]
  }
]
  • Now attribute ‘B’ will have the value.

You can push to multiple attributes. See this tutorial for more info: Tutorial: Open Weather API using HTTP Agent · openremote/openremote Wiki · GitHub

There might be a better solution that I can’t quickly think of now :slight_smile:

Don

1 Like

Will take a look. Thanks!

Invalid JSON :wink: missing a closing ]

But I got it. Currently configuring and well report back.

I just had it working.

But I needed to change an attribute from Integer to Long but since some data was already stored I think now something is buggy :smiley:

I created a new asset to start fresh, but now when I want to add attribute links to the asset and press save I get this. . .

Log:

openremote-proxy-1       | 03/Jul/2023:19:20:56 +0000 https~ 172.19.0.1:55026 manager 0/0/0/14/14 "PUT /api/master/asset/4DrKYOjRz8AyWTFX1EiOla HTTP/1.1" 204 2/2/1/1/0 0/0

And now its just doing nothing…
Not only for this one asset but for all assets :roll_eyes:

I manage to break it all :rofl:

1 Like

Ohhhhhh!

Since the Asset is getting new Data every second even while configuring, the web view is getting resetted.
That’s why the JSON Object in the put request does not contain the the config for the attribute configuration.

:eyes: this sounds like a “bug” or unintended behavior.

Working now:

Thanks @Don :love_you_gesture:

1 Like

Added an update function to my code so on device creation it will set the Attribute Links, Attributes with meta to storeDataPoints.

1 Like