Display charts graphics in tiles

For chart data in a device handler I now use carouselTile, and have chart images created with a replacement for the Google Image Charts, just one url with the data, you get a picture as response, can be moved straight into the carouselTile. Still have some issues with the fonts used, but looks promising.

3 Likes

Sounds good. What are you using to generate your charts?
I originally used pChart on my side. So the image would get refreshed at the server side pace. Using the carousel, does it refresh automatically if the source is updated?
Or you have to refresh manually/re-open the DTH tile?

image-charts. The same API as google image charts, with some limitations. The chart is created on the server, image is send back. Currently the DTH creates the chart with a command, but that can easily be adapted to run on a schedule if needed.

1 Like

Thanks, I was so eager to test it that I found your GitHub in between :wink:

I am now making a test with a dumb DTH to see that. I had this idea too using the carousel but got stuck when I had to tie that to a non AWS image location. Your implementation solved that as I see.

[Update]: I got it working but as usual in ST, things work differently if you access local network versus external (www). I didn’t want to publish externally my webpage so I have to adapt your get to GET from local IP via a hubAction.

Thanks a lot anyway for showing the way

Hi,

I was using the following code to generate charts on my device handler. The “dl” variable is an array with 192 integer elements. Recently I started getting the following error when the chart is called in DTH refresh function (periodically)
I don’t get the error when I call the chart function manually (with a button on the DTH)

Does anybody know what does this error mean ?

javax.net.ssl.SSLException: java.security.ProviderException: java.security.InvalidKeyException: EC parameters error @line 1674 (genGraph)

here is the code which calls the chart :

def genGraph()
{
log.debug "genGraph"
	def dl ="t:"
    def ul ="t:"
    def tt ="t:"
    for (int i = 0; i <  191; i++){
    dl = dl + state.listdl[i] + ","
    }
    dl = dl + state.listdl[191] + "|"

	for (int i = 0; i <  191; i++){
    dl = dl + state.listul[i] + ","
    }
    dl = dl + state.listul[191]

    def maxx = Math.round(state.listdl.max())
    def maxx2 = Math.round(state.listul.max())
    if (maxx2 > maxx) {maxx=maxx2}
    
    def aralik = maxx/5
    
    
       def podParams = [
          uri: "https://chart.googleapis.com",
          //uri: "https://image-charts.com",
          path: "/chart",
          query: [cht: "lc", chd: dl, chs: "400x250", chof: "gif", chxt: "x,y", chxl: "0:|-12hr|-8hr|-4hr|now", chco: "00FF00,0000FF", chtt: "Traffic", chts:"AAAAAA,15", chxr:"0,0,192,1|1,0,"+maxx+","+aralik, ],
          contentType: 'image/gif'
        ]
        httpGet(podParams) { resp ->
            //log.debug resp.data
            saveImage(resp.data)
        }
        //log.debug "Created new graph"
genGraphx()

}

btw, when I use “https://chart.googleapis.com” instead of image-charts.com , there is no problem.

i just started getting this in my smart app on a 3 hour refersh
javax.net.ssl.SSLException: java.security.ProviderException: java.security.InvalidKeyException: EC parameters error @line 661 (apiGET)

my DH wont refresh on a schedule but works when i click it manually
java.lang.reflect.UndeclaredThrowableException @line 443 (poll)

so , you have the same problem or not ?

you also use image-charts.com ?

1 Like

Same problem and symptoms its just started, but no dont use that

then something has changed on smart things cloud.
let’s ask support.

I did log a ticket but they just came back with they dont support custom DH

does your code retrieve an image with HTTPGET ? or is it just text data ?

It asks for a response from a web server using http

no image ?

the error you receive is on the line where you get the response ?

This in the DH
def resp = parent.apiGET("/subdevices/show?params=" + URLEncoder.encode(new groovy.json.JsonBuilder(body).toString()))

The smartapp started with this error it must be a permissions or security issue
javax.net.ssl.SSLException: java.security.ProviderException: java.security.InvalidKeyException: EC parameters error @line 661 (apiGET)

but it works fine when i mannualy refersh

bit more digging and the apiGET calls this in the smartapp, the last log debug dosnt get trigged
this is the last “good” response Beginning API GET: /subdevices/show?params=%7B%22id%22%3A123008%7D
def apiGET(path) {
try {
log.debug(“Beginning API GET: ${path}”)
httpGet(uri: apiURL(path), headers: apiRequestHeaders()) {response -> //hissy hear
log.debug(“response ${response}”)
logResponse(response)
return response

anybody else in this situation ?

Update its stoped working completely
Done some diging. Long story short smartthings dosent like the security credentials (encryption curve) of the response back (nether did my work computer using postman) check to see if your host is cloudfair (ip check) they host my mihome.co.uk issue

thanks for the update. so what is the solution ?
(btw, how can I check if my host is cloudfair ? which host ? image-charts.com ?)

Google ip Check. Then just put in the web address you want to check