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鈥檙e adding a filter to the asset attribute picker so you can鈥檛 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 鈥楢鈥
  • Add the attribute link configuration item to that attribute to push a filtered value to another attribute 鈥楤鈥
  • 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 鈥楤鈥 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鈥檛 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鈥檚 why the JSON Object in the put request does not contain the the config for the attribute configuration.

:eyes: this sounds like a 鈥渂ug鈥 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