History of Device

Is it possible to show the history of a device on a Dashboard? By way of example, I’d like to see how long a greenhouse heater has been on each day. Currently I get the history directly from the device in SmartThings. I’d like to not have to leave the SharpTools dashboard to get it.

Thoughts??

3 Likes

This is actually a pretty cool idea that can be extended.

I was planning to start looking at a solution to start monitoring things like my house temp etc over time and map it. However all this info is already sent to sharp tools.

It would be cool if sharptools kept the history (for a period of time) and offered a “graph” tile that would allow us to add the info to a dashboard easily.

If you add this to the feature request section I’ll add my vote for sure.

3 Likes

TAustin has an Edge Driver “Edge Counter Utility V1” that does that.

1 Like

So I would use that driver for each device I want to monitor?

I don’t use it, so I don’t know. Here is a link to the discussion on the ST site.

This is a really rough proof of concept, but here’s a concept for trending event history from SmartThings. It uses an undocumented API for grabbing the event history and filtering to your desired attribute:

:arrow_double_down: Import SmartThings History Trend Demo

If anyone wants to take over and modify it into a proper custom tile, feel free to. :rocket:

chrome_tuKl1ZNqAi

@Kampto has an Area Plot tile that does something similar for Hubitat:

Area Plot (Trend/Chart), Custom tile, Hubitat only

2 Likes

I do this sort of thing with Hubitat using the quick chart app.


Josh-
I created the personal token. Where do I locate the attribute name and Loction ID. They are not jumping out at me… Are they called something else in IDE?

You can get everything, except the Personal Access Token (PAT), within SharpTools if needed.

  1. Open your SharpTools.io User Page
  2. Tap the ... next to your location
    Location ID: flip the Advanced Toggle in the top-right corner on to see the ID
  3. Scroll down and tap on the device in questions
    Device ID: flip the advanced toggle on to see the ID
    Attribute: scroll down to view the list of attributes

Note that this is basically just a proof of concept and is designed around attributes that report a numeric state.

For something like tracking on/off state, a chart type more like the horizontal bar displayed in Justin’s graphic might be better suited.

Is Device ID the same as Thing ID?

Yes.

And do not edit the settings directly in the Custom Tile Editor. That section is for developers to edit which settings are provided to the user. Just do a fresh import of the tile, scroll down and save. Then go add it to your dashboard and edit the copy of the tile that’s on your dashboard.

I have subscribed to Constantgraph. I’m able to get my device history from SmartThings and create some decent graphs. Any idea how to get this graph with an HTTP GET or HTTP POST and put it in a Custom tile?
Capture

2 Likes

This gives me what I was looking for over the last 24 hours using Constant Graphs.

GH2-TEMPS Green House 2 - temperature
Thu 07:00 PM Nov 17, 2022 60.13
Thu 06:00 PM Nov 17, 2022 61.31
Thu 05:00 PM Nov 17, 2022 61.31
Thu 04:00 PM Nov 17, 2022 60.13
Thu 03:00 PM Nov 17, 2022 60.13
Thu 02:00 PM Nov 17, 2022 57.75
Thu 01:00 PM Nov 17, 2022 58.94
Thu 12:00 PM Nov 17, 2022 57.75
Thu 11:00 AM Nov 17, 2022 58.94
Thu 10:00 AM Nov 17, 2022 60.13
Thu 09:00 AM Nov 17, 2022 60.13
Thu 08:00 AM Nov 17, 2022 54.19
Thu 07:00 AM Nov 17, 2022 60.13
Thu 06:00 AM Nov 17, 2022 61.31
Thu 05:00 AM Nov 17, 2022 58.94
Thu 04:00 AM Nov 17, 2022 61.31
Thu 03:00 AM Nov 17, 2022 58.94
Thu 02:00 AM Nov 17, 2022 58.94
Thu 01:00 AM Nov 17, 2022 61.31
Thu 12:00 AM Nov 17, 2022 61.31
Wed 11:00 PM Nov 16, 2022 61.31
Wed 10:00 PM Nov 16, 2022 58.94
Wed 09:00 PM Nov 16, 2022 61.31
Wed 08:00 PM Nov 16, 2022 60.13
Wed 07:00 PM Nov 16, 2022 60.13
Wed 06:00 PM Nov 16, 2022 58.94

Is there any further progress on this. I tried to run the demo but kept getting the “Please configure the tile” error. I entered all the parameters requested. Has there been some SmartThings change that stops this from working?
I would find a simple graph tile very useful.

Can you share a screenshot of how you have things configured (with your PAT blurred out)?

Getting that error message usually means something is misconfigured. The tips above are really important. If you edit the settings in the wrong place (eg. in the Developer Tools rather than the copy of the tile you’ve added to your dashboard) or use an invalid Device ID / PAT

I was using the developer tools but now I’ve added the tile to my dashboard and edited it. The tile now just says “Loading”.
Here’s a screenshot of the configuration screen.

It still looks like it’s been adjusted in the developer tools as those look like the slightly grayed out labels.

In the Custom Tile developer tools, the settings section should look like this (which is the default after importing):
image

If that’s not the case, which is doesn’t appear to be based on your screenshots, you can reset the tile by using the Update from Source option in the cog menu in the code editor.

image

Make sure to save the changes after you update from source so it saves the reset. Otherwise, you might find it easier to delete the Custom Tile from your dashboard and delete it from your Developer Tools, then start over.

When it’s added to the dashboard and you go to edit the instance of the tile, the fields will be blank and you can tap into them to edit each field:

Then once you’ve added your data into those fields, it would look like:

Thanks for the detailed explanation Josh. I did an Update from Source and then entered the parameters via the dashboard editor as suggested and everything now works as expected. This is a really useful feature that I can use for example to plot temperature history. The only issue I have using the tile is that the graph legend is the attribute. I am not an HTML programmer but I might try to add a parameter to the code, allowing this to be entered via the dashboard tile editor. In the short term I have manually edited the code.
Thanks again for your help

I’ve managed to edit this demo to include a dynamic Title (to include date range and number of points) plus configurable attribute and it works very well for analog attributes such as temperature. It’s not so useful for binary switches etc. As far as I can see, chartjs does not offer a square wave type chart so it is perhaps necessary to insert into the array some intermediate points. This is outside my skill level but if anybody has some advice or code to do this please advise

Update: I’ve completed development of my graph tile and am pleased with the result. I’ve added a second series which has taken me a while as I am not a JS/ChartJS expert. The only issues I’ve found are:

  1. Limit of 7 days but useful to have a day parameter to reduce this
  2. Need to refresh the page to update charts. Can be slow with multiple large charts
  3. Error 429 (throttling) occurs but mostly during development
  4. Need to increase block count - especially on devices with multiple attributes
  5. Switches can be displayed with stepped parameter but useful to insert an extra point at current date
  6. The data array for the chart must be changed to an x/y object for 2 series to work correctly

I hope this helps others who are trying to build a chart tile