New standard widget: Timeline

Could you add the ability to specify a title?

Yep, done.

Thanks, it works!

I am using this widget to display the current state of my HVAC system. I am storing the values with rrd4j so I am using integer values 0, 1, 2, and 3 to represent the different states.

Using numerical values, I see some odd behavior. Sometimes the timeline widget displays incorrect values / colors for points in the graph. Take a look at this screenshot, in which I am mousing over the small red sliver near the end of the graph. The displayed value is “0.75”, but that value was never sent to the item, and never shows up in the OH events.log. The item transitions directly from 0 (grey) to 3 (green) at this time.

2017-05-02 15:07:05.524 [ItemStateChangedEvent     ] - upstairs_thermostat_hvac_state changed from IDLE to FAN
2017-05-02 15:07:05.533 [ItemStateChangedEvent     ] - upstairs_thermostat_hvac_state_enum changed from 0 to 3

Perhaps this is a rounding or precision error or something? By the way, right now this seems to happen only for 12h or greater periods. If I use 4h or 8h periods then I don’t see this issue. Pushing it up to 1 week gives even weirder values.

That sounds like a normal rrd4j behaviou. What are your settings for the archives? You see that behaviour on values older then 12 houres. So you should have an archive which covers anything up to 12 houres and at least one for longer times. These other archives do calculate a single value for a time period, the calculation method is decided by the user (or the default).So, if the user decided to calculate those values for longer time steps out of the average of the smaller steps you will see such values. In other words, garbage in garbage out!

Interesting, I’m not that familiar with rrd4j so perhaps I was making some assumptions. So I’m understanding you correctly, this would only be a problem on data that is more than 12 hours old. In my screenshot above, I was examining data that had been recorded 10-15 minutes ago, so I’m not sure if this is the same issue. Also, as mentioned, this problem goes away when viewing the same data on a smaller graph timeline (4h vs 12h).

I’d like to be sure though. How do I check the settings for these archives, and/or set the calculation method for old values? I only need 24h of data, so is there a way configure rrd4j to keep all recorded values for 24 hours instead of 12?

In case it helps, here is my rrd4j.persistence:

Strategies {
    everyMinute : "0 * * * * ?"
}

Items {
    gLogEveryMinute*, gTemperatureSensors* : strategy = everyChange,everyMinute
}

I just took the stated 12 houres from your post, rrd4j can be setup to persist to any desired time. Since you are positing your rrd4j.persist file only, I assume you are using the default setting of this database. This default will persist for every minute over the last 8 houres, the next archive holds the values for each 14 minute step for 644 cycles (count the covered time yourself). Other archives are following.Exemt in the first archive all the values are calculated using the average value of each minute in that timeframe.
That was the default, you can change that in order to have only one archive that holds each Minute value for the last 24 houres! Read the docs for this OpenHab1 addon!
(Edit))
A last point on which I’m not sure: Since rrd4j has values for each minute (or larger steps) you might hover with the mouse over a point in between measurements, resulting in a calculated mean between points.

Well, I tried reconfiguring RRD4J and it still isn’t working as expected. I created the following rrd4j.cfg:

hvac_state.def=GAUGE,60,U,U,60
hvac_state.archives=LAST,0.5,1,10080
hvac_state.items=upstairs_thermostat_hvac_state_enum,downstairs_thermostat_hvac_state_enum

If I understand the documentation, then this should provide logging for every second for a period of one week (10080 minutes), and if multiple values are stored in a period of one minute, it should use the LAST one stored. So there should only ever be integer values stored, since I am only ever setting the item value to 0,1,2,3.

After making these changes, I deleted all rrd4j archives from /var/lib/openhab2/persistence/rrd4j, uninstalled and reinstalled rrd4j binding, and restarted OH. I’m pretty sure the changes took effect since the archives for these two items are now larger than the others.

However, I still see the same behavior. Values for the exact minute where I make an update to the item are displayed in the timeline widget incorrectly. The values seem to be something between the previous state and the new state, e.g. if I move from 0->2 then the value is reported for one minute as “1.9966666…”.

Maybe I’m still making some incorrect assumption about the operation of rrd4j, but I’ve spent enough time on this, I’m just going to switch to mysql persistence instead and see if this still happens.

I guess this could be the issue, but you can see on the timeline widget which exact minute is highlighted.

For example, this is showing from 23:35-23:36:

But yes, it’s a possibility that the timeline widget itself is displaying these values improperly for some reason. I was trying to rule out problems with rrd4j by changing my config, but since I don’t know of a way to inspect the actual data in the database directly, I can’t say if it’s a timeline widget problem or a rrd4j problem.

To check the value strored I’d use the REST Api.
You need to install REST Docs to get this GUI.
In the section persistence you can select the item you are looking for and REST Api will show all stored values for this Item for the selected timeframe.

OK, I installed the REST docs and found the data. The bogus values are indeed present in the database. Still no idea why this is happening though, since my rrd4j settings should specifically prevent it.

    {
      "time": 1493831940000,
      "state": "3"
    },
    {
      "time": 1493832000000,
      "state": "2.95000000000000017763568394002504646778106689453125"
    },
    {
      "time": 1493832060000,
      "state": "0"
    },

At any rate, I guess we can rule out this being a problem with the timeline widget. Sorry for the temporary thread hijack!

Just to close on this - I switched to mysql persistence, and I have no more problems. The widget now displays only the values that I set, as expected. Never figured out my config issue with rrd4j, but maybe someone else will see this and save themselves some frustration.

1 Like

Hello!
The number of series in one widget is limited to -16?

Waw this looks like a great feature, will look into it test and report back. Thanks and keep up the great work.!!

FYI: I created an issue for the automatic refresh feature, which is not implemented, yet.

Edit: ysc added the feature and it should be available in the snapshots as of 22nd July. There is no setting, it updates depending on the displayed time range. Thank you ysc!

2 Likes

What mount are you using that looks nice?

Google sibo 896s

Yannic - this is an awesome widget - I am using it for tracking radiator / heating status in my house, as well as motion detection and Window / door cycling . . but i have a problem.

I have been trying to wrap this into my imolementation of one of the other HabPanel themes on here - and I just can’t figure out how to do it.

My setup is loosely based on Patrick’sMatrix theme.
I have been able to recycle some of the built in widgets using code like:

<div class="widget">
			<div class="name">Kitchen<div class="value">{{itemValue('yamahareceiver_zone_2_channels_volume')}}</div></div>
        <div class="controlGroup">
     <div ng-init="slider_kitchen = {
    'item': 'yamahareceiver_zone_2_channels_volume',
    'vertical': false,
    'floor': 0,
    'ceil': 100,
    'step': 2,
    'precision': 1,
    'unit': '%',
    'hidelabel': true,
    'hidelimits': true,
    'hidepointer': true,
    'showticks': false,
    'bigslider': false,
			'disabled': false                  
    }">
 <widget-slider ng-model="slider_kitchen"/>
        </div></div>

but I have mostly figured this out by bodging code from other people.

Are you able to tell me how to do this correctly please?

Thanks

The timeline is one of those widgets which will try to get its dimensions from the encompassing box, so it’s tricky to include in a template…
You might be able to make it work using the same hack as the knob widget:

For the model to pass, use the trick in HABPanel Development & Advanced Features: Start Here! - #11

Instead of documenting every possible model option for every widget, here’s a trick: add your widget to a dashboard the standard way with the designer, give it an unique name to find it back easily, adjust the options as you like, then go to HABPanel’s advanced settings and click on the “Edit the local panel configuration” link. You will then have to find your widget (using its unique name) and you’ll have the complete model to pass to ng-model this way. You can leave out the row, col, sizeX, sizeY, type attributes since they’re relating to the dashboards layouts themselves - type is the type identifier to put after widget- as the node name.

Thanks very much - that helps a lot.

I’ll spin it up like you said and see how far I get.