Timeline for Basic UI

I will try it on my other system with internet access.

With internet access the heavy load is gone but the problem with empty timeline exists.

You could try to download https://www.gstatic.com/charts/loader.js, place it in the javascript folder and modify the src to include it from there - like the other scripts below it.
But, if it contains scripts from the web, you’ll be in the same situation.
jquery.min.js is already in the javascript folder so you can leave the include from web commented out.
Might worth a try


I’ve done that too. Solves only the problem with heavy load :wink:

If I add height=6 is is better, but not good.

The second Webview


...Timeline.html?gSwitchStatusSW...

sould be

...Timeline.html?Item=gSwitchStatusSW...

ups, yes you are right.

Solved the problem in basicUI. Is there any chance to fix this in classicUI too? It looks like the dimension of the windows is calculated wrong here.

ClassicUI:

BasicUI:

Sorry, not using classicUI and I’m definitely not able to help with that :smile:

@patrik_gfeller
no problem, maybe patrik_gfeller can help.

But it is working perfect in BasicUI. cool.

yes, I use your version and added the “
&serviceId=rrd4j
” parameter, but no change

I notice one thing
 you have HueTemp defined as a Number.
Timeline is suitable to represent items with only 2 states, like switches and contacts.

ok, I took HueTemp out of the timeline group. Unfortunately no change.

I wondering, if there shouldn’t be a scale at all


I think it will not work with rrd4j. Because rrd4j will not really store datetime and points. It just creates accumulated datas for charting.

This could be the problem. With jdbc it is working perfect.

You’re absolutely right, rrd4j is not good for charting.
But this is not all, even without persisted states timeline should display the items without states.
@Matt_Hias, after you change the persistennce, could you modify the url of the Webview element to include the full URL to your server?

Webview url=" http://address/static..."

Also, could you try that url directly from browser?

That’s it: I changed to influxdb and added the complete URL to the webview-thing:

Many thanks so far.

But why does it required the complete URL? It’s different in your setup, isn’t it?

Best Regards
Matthias

if I open the url in Firefox I get
TypeError: array is null in openHAB.js:55:21
For what its worth, objArray is null too.

Its the for loop of

// JSON to CSV Converter
function ConvertToCSV(objArray) {
var array = typeof objArray != ‘object’ ? JSON.parse(objArray) : objArray;
var str = ‘’;

for (var i = 0; i < array.data.length; i++) {
    var line = '';
    for (var index in array.data[i]) {
        if (line !== '') line += ',';

        line += array.data[i][index];
    }

    str += line + '\r\n';
}

return str;

}

I tried different items and groups and adjusted the persistence to “influx”

tracking it a bit further
jsonData = GetData(encodeURI(itemUrl));
fails with itemUrl being “
/
/
/rest/persistence/items/KG_Gaeste_Fenster?serviceId=influx”

1 Like

Does the URL work in a browser?
Also, shouldn’t be influxdb instead of influx?

@Mihai_Badea, Thanks, your hint got me one step further.

I tried some urls in the browser. Here are the results

[Result] URL
[ OK ] http://192.168.1.52:8080/static/Visualization/Timeline.html?Item=KG_Gaeste_Fenster?serviceId=influxdb
[Fail] 
/static/Visualization/Timeline.html?Item=KG_Gaeste_Fenster?serviceId=influx
[Fail] 
/static/Visualization/Timeline.html?Item=KG_Gaeste_Fenster&serviceId=influxdb

Lessons learned:

  1. It really has to be influxdb not influx
  2. The serviceId is appended by a ? in the URL where it should be a & (tested with Firefox mobile)
  3. It only works for Contact items that return 0 or 1. I also have some that return “OPEN” and “CLOSED”, those fail to display completely. Same for groups with such a contact in it.

technical background: I run a wired Homematic system.
Input module HMW-Sen-SC-12-DR
#SENSOR returns open/closed
Input module HMW-IO-12-Sw14-DR
#VALUE returns 0/1

Actually, I had it working for Contact items with OPEN/CLOSED states
 but apparently I didn’t upload the latest version :smile:.
Please, try and download again html.zip The only changed file is Timeline.html.

I’m not sure what you mean by that
 The REST API clearly uses ? not &.

@Mihai_Badea,

I’m not sure what you mean by that
 The REST API clearly uses ? not &.

on march 7th you posted :
Webview url="/static/.......?Item=timeline&serviceId=rrd4j" height=...
Please note that the html parameter list is started by ? but the parameter delimiter is & in your post. I found it working with ? as parameter delimiter.

Please, try and download again html.zip The only changed file is Timeline.html.

will do this evening. Thanks.

Actually, what I wrote is correct.
To transfer parameters to Timeline.html one has to use &. That’s why the Webview examples are given with &.
REST API, however, uses ? so, when Timeline.html queries the persistence it will append needed parameters with ?.