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.
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.
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:
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?
Tap the ... next to your location Location ID: flip the Advanced Toggle in the top-right corner on to see the ID
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.
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?
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):
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.
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:
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:
Limit of 7 days but useful to have a day parameter to reduce this
Need to refresh the page to update charts. Can be slow with multiple large charts
Error 429 (throttling) occurs but mostly during development
Need to increase block count - especially on devices with multiple attributes
Switches can be displayed with stepped parameter but useful to insert an extra point at current date
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