Dashboard - update Device ID in all Blocks

dashboard
#1

I created a Dashboard for one of my devices containing about 10 blocks. I now want to use this Dashboard template for my other 100’ish devices. I simply cloned my original Dashboard, but now realize that I can’t find a way to link my new dashboards to my other devices, other than by manually going into each and every Block and changing it.

Surely, there must be a more efficient way of doing this?

For that matter: Is it possible for everything in a Dashboard to automatically link to only one device? I have no need to display data of multiple devices on the same Dashboard.

#2

Have you tried out dashboard context yet? We created the feature for the exact use case you’re describing here. I recommend you start there and let us know if you have any questions.

Also, I would recommend adding a Device List block onto your “master” dashboard and setting a custom link that sets your current context variable to the ID of the device you clicked. That gives you navigation of sorts between your different dashboard states.

#3

I already looked at that link, but probably do not completely understand how it is used. I have two dashboards: for Building 1 and 7. Building 7 is my original dashboard, which I copied for use for Building 1.

So after copying the dashboard, I went into the Context Menu of Building 1 and did the following thing:

However, all my Blocks are still referenced to the Device located at Building 7. All my devices are also still considered to be valid input for these Blocks.

Note: Due to the nature of my project, my “Devices” are actually named after the Buildings, not the actual sensor devices I have. We switch devices around all the time, so not wanting to lose my Dashboard data I plan to simply change the Device Tag of Devices to make it correspond with the correct Particle device I’m using.

#4

Check out this video we made that explains how to build out the scenario you’re describing.

The gist of it is, on your “master template” dashboard …

  1. Create a context variable for your device ID (say it’s called “deviceId”)
  2. In all of the blocks, remove the device you’ve currently selected and change it to “{{ctx.deviceId}}”.
1 Like
#5

Thanks, got everything to work exactly the way I want it :slight_smile:

Question: If I were to Create an Organization, is there any way to mass-update my Dashboards? e.g. say I have 200 identical Dashboards, but I want to have one extra graph added for all of them.

#6

By “identical dashboards”, do you mean the scenario we started with where really it’s just one dashboard that uses context variables? If so, it should be easy to add that block like adding any other and using the variables in the query.

If you actually have 200 different dashboards and want to add the same block to each, there’s no easy way to do that in the UI at this time. Your best bet would be to write a script that uses the Losant REST API to get the dashboards, modify each by adding the block and then PATCHing each.

#7

Yes, one dashboard using context variables, which gets copied 200 times. Prior to doing the copy’ing it of course is easy to adjust things as needed, so my question pertained to adding content AFTER it has been copied 200 times.