Question about configuring UI Widgets (Label Card?)

Hi,

  • Hardware: Raspberry Pi
  • OS: openhabian-pi-raspios32-202308121256 ()
  • Java Runtime Environment: openjdk 17.0.7 2023-04-18
  • openHAB version:openHAB 4.0.3 - Release Build

I’m building my UI and trying to add some widgets I’ve seen on the openHAB demo page. This one:
image
has a graph on the background, and no matter what I do, I can’t seem to replicate it!

I’m pretty sure is a Card (as opposed to a Cell), and I think it is a Label Card. I’ve got the temperature showing, but can’t get the graph:
image

I feel like this is a really simple solution (like a check box I’ve missed!), but I’ve spent a couple of evenings now experimenting and can’t seem to find the solution. I’ve looked at this page: Component Reference | openHAB but it doesn’t seem to have the answer.

Also, how do you set the number of decimal places to display?
Thanks for any help :grinning:

Why not login to the demo server and check how it was done ?

Follow that page all the way to the bottom and look at the section about trendline properties.

You will want to add state description metadata to the item. There are many posts you can find here if you search for state description metadata.

Didn’t know you could!

I’ve logged in and had a look, and my settings are the same as the demo (including advanced settings), but it’s still not showing the graph. I noticed there was a difference in the YAML code - is this an OH3 / OH4 difference?

Demo page YAML:

component: oh-label-card
config:
  trendItem: Temperature_FF_Son
  action: analyzer
  actionAnalyzerItems:
    - Temperature_FF_Son
  icon: oh:office
  item: Temperature_FF_Son
  title: Office
slots: null

my YAML code:

component: oh-label-card
config:
  title: Label Card
  action: analyzer
  actionModalConfig: {}
  actionModal: page:page_6b4150988a
  item: Generic_MQTT_Thing_Lounge_Air_Temperature
  icon: oh:office
  trendItem: Generic_MQTT_Thing_Lounge_Air_Temperature
  actionAnalyzerItems:
    - Generic_MQTT_Thing_Lounge_Air_Temperature
slots: null

I tried copying the demo page yaml into my UI (and correcting the item names!), but still no luck.

My understanding of the documentation is that the trend line is a straight line going up or down (diagonally) indicating that the number is increasing or decreasing. eg:
image

I’m after a graphing background. Or have I completely misunderstood this?

Thanks - I’ll take a look…

This should be a full graph. The fact that you only see a straight line is most likely an indication that your persistence data for the last 24 hours does not include the data you are expecting. You need to check 1) the persistence settings for that item and 2) if you have more than one persistence service configured that you have properly set the one you want as the default service for for the UI (trendlines will only use whatever that default setting is). You can also try changing the trendSampling property, but I doubt that is the issue in this case.

Thanks for your help on this, but I think I’m going to give up on getting it to work. I’m pretty sure the persistence data is correct. I can get it to show the graph when I click on the widget, e.g. Action > Analysis Items(s) gives me this graph:

So the data is there and it can plot it, but it just won’t show it on the widget itself. And I don’t know what to try next.

However, I managed to set to 1 decimal place, so thanks for the pointer!

Well, according to that graph your data fluctuates within only about 1 degree C in a day. The trendline is produced by an external library so I don’t know all the details of how it works, but I’m guessing that, by the time it’s gets the downsampled data (only 1 point/hour) and throws in some rounding error and some smoothing (moving average, as far as I can tell), your data is simply reduced to a straight line.

I would hope that the scale of the data wouldn’t impact the the trendline to such an extent, but that’s my only guess. You can try just putting any other item in there for a test as long as it has a much larger range (an outdoor temperature perhaps) just to see that the line does work under other circumstances. At least that way you would know it’s just the data in that item and not some aspect of your persistence configuration.

The only other option is that the persistence rule for that that item is set to something other than every minute (every change perhaps?) and that difference in data density is interfering with the basic processing the oh-trend does before sending the data off to the external library.

Thanks Justin, a few things to play with if I get a bit of time :+1: