Device.statesSince() documentation incomplete?

I am currently trying to access historic data for one of my devices and am using statesSince() for that.

According to the documentation, the [max: N] map is optional - based on that I would assume that it would return all events (up to the maximum quoted 1000) since the data specified. However, it seems that it only returns 10 events in that case - is this a feature, bug, or lack of documentation?

SmartThings only keeps a 7 day event history so that might be the reason you’re only getting 10 events.

1 Like

I have well more than those ten events in 7 days - I should have mentioned that adding [max: 1000] (or something smaller and more reasonable than that) will return more than the 10 results I get back without adding it.

It seems to me that not adding the optional Map will limit the number returned - which is not obvious and doesn’t sound right to me.

@jim could you please clarify the intended and actual behaviors?

I doubt it’s a bug and I probably would have built it the same way, but I agree that it should be mentioned in the documentation.

Yep, updated the docs for this, sorry for the confusion.

2 Likes

Thanks for updating the documentation!

Querying device history in conjunction with htmlTile allows for very cool stuff - I managed to show today’s energy production overlaid with yesterday’s data for my solar array (custom device type) using Google Charts:

(Note that this is not an image but rather a dynamically created chart).

I still need to do some cleanup (both code and visual - the graph size needs to be improved) but will post the code when I’m done.

5 Likes

I didn’t even know there was an htmlTile. Do you know where the documentation is?

If there isn’t documentation, would you mind posting a section of your code so I can see how the tile works?

I don’t think that there is any official documentation - lots of trial and error might get you there :wink:

Sure - the latest code on my Github for my local device handler for the Envoy solar monitoring device uses it:

1 Like

Thank you for posting the code. I was able to extract the html related sections into a new device handler and display custom html so no trial and error will be needed.

I can now create a dashboard device handler to go along with my Simple Device Viewer SmartApp.

1 Like

I’m glad you posted this because the new nest device handlers are using html and I was nervous about releasing publicly.

I don’t think you should be nervous about that - there is at least one official ST device handler that uses the htmlTile:

Did you figure out how to force the htmlTile to reload on an event? Do you need to send an event to the htmlTile?

That doesn’t mean anything unless the device is on their officially supported list.

See this post for an example.

Still looking into that, but I did just figure out how to stream a video and audio through it…

I’m referring to playing an existing mp4 file from a 3rd party website that doesn’t require authentication.

There is no documentation for this. We did a developer beta for HTML a couple months ago. The current implementation is/will be undergoing an overhaul based on our internal and beta feedback. I don’t have an ETA on when HTML-based development will be supported at this time; and while I’d be trying these things out myself were I in your shoes, I’d be remiss if I didn’t at least mention that current implementations will not be backwards compatible with likely upcoming changes prior to this being supported.

I don’t want to discourage developers pushing the envelope with these capabilities, but want to err on the side of transparency/appropriate expectations WRT to support/maintainability of htmlTile.

tl;dr - use at your own risk and the current implementation can and will change without notice.

2 Likes

Nothing works that I could find would trigger a refresh… I also haven’t put much time into it :slight_smile:

Thank you responding this post. I’d rather not blindly try to figure out how to make something work and then have to do it all over again once things change.

Thanks for the clarification - I believe that there are a lot of cool things that can be done with this tile and having developers explore use cases might help getting it finalized in its most useful way.

Would it be possible to give some kind of advanced warning when/how the implementation changes?

2 Likes

Thanks Jim…

I realize this isn’t documented… But is there any trick to refresh an htmltile without reloading the page?

Yes, and that was one of the primary goals of the beta. It’s a feature we are pretty excited about, because it offers developers a lot more power and control.

I wish I could commit to providing more information and notice, but I can’t. We need to focus on better supporting/documenting our currently supported APIs, and as this feature is under development, things can and will change without notice. If a usage of this tile remains in the public repo, you could watch for any changes there.

Right now the current implementation is sort of forked between old and new, so I’m not sure with the existing example how that would be done without digging in a little. And even if I could do that, the mechanism to do so would likely change in the near future.

I know this is off topic but I signed up for the beta months ago and I’ve heard nothing. Are the betas you’re referring to internal ones?