[SOLVED] Graphs with RRD4J

This is my .item for weather with the weather addon, i try this Temperature item without group but not work

String Conditions “Conditions [%s]”
Image Icon “Icon”
DateTime ObservationTime “Observation time [%1$tH:%1$tM]”
String ObservationLocation “Location [%s]”
String Station “Station [%s]”

Number Temperature “Current temperature [%.1f °C]”

Number ForecastTempMin “Forecast min temp [%.1f °C]”
Number ForecastTempMax “Forecast max temp [%.1f °C]”

OK create a Group called Temperatures (With an s)

Items:

Group Temperatures
String Conditions “Conditions [%s]”
Image Icon “Icon”
DateTime ObservationTime “Observation time [%1$tH:%1$tM]”
String ObservationLocation “Location [%s]”
String Station “Station [%s]”

Number Temperature “Current temperature [%.1f °C]” (Temperatures)

Number ForecastTempMin “Forecast min temp [%.1f °C]”
Number ForecastTempMax “Forecast max temp [%.1f °C]” 

Persistence:

Strategies {
    // for rrd charts, we need a cron strategy
    everyMinute: "0 * * * * ?"
    default = everyChange
}

Items {
    Temperatures*: strategy = everyUpdate, everyMinute
}

Ok, now the graphics disappear, I have also modified the sitemaps in this way

Chart item=Temperatures refresh=6000 period=h

If i put only Temperature item, the graph reappears but empty

Only thing I can suggest is to uninstall rrd4j, restart oh and reinstall rrd4j

I’ll try that and if it does not work I’ll try with InfluxDB+Grafana.

Thanks for all!!

Hi,

I remember I had the same issue like you at the beginning. I would strongly recommend to try out RRD4J before Influx+Grafana. This is a bit more complex to master than RRD4J.

It may sound awfully stupid, but what helped with me, was to create a new group, which I persisted.

Also, I assume you still have the corresponding channels in your Item file?

Just sharing some example from my implementation, with different bindings:

ITEM FILE:

    Group TempusChart	
    Group Tempus "Temperatur" <temp> (Home)
    Group Wetter "Weather Items" (Home)
//Some Item from the Yahoo Binding
Number Temperature_yahoo "Aussentemperatur (MD) [%.1f °C]" <tempoutside> (Wetter, Tempus) { channel="yahooweather:weather:7665b22d:temperature" }
//Some Item from the Wunderground Binding
Number Forecast2TempMin "Minimal Temp. übermorgen [%.1f °C]" <tempoutside> (Wetter) {channel="weatherunderground:weather:local:forecastDay2#minTemperature"}
//Some Item from the Weather Binding
Number   Temp_Feel        "Temperatur gefühlt [%.2f °C]" <tempfelt> (Wetter, Tempus, TempusChart) {weather="locationId=home2, type=temperature, property=feel"}

// You can use this dummy item to change the measurement time in your graphs
Number IntervallTempus

SITEMAP FILE:

Switch item=IntervallTempus label="Temperaturverlauf" mappings=[0="Hour", 1="Day", 2="Week", 3="Month", 4="Year"]
Chart item=TempusChart period=h refresh=30000 visibility=[IntervallTempus==0, IntervallTempus=="Uninitialized"]
Chart item=TempusChart period=D refresh=30000 visibility=[IntervallTempus==1]
Chart item=TempusChart period=W refresh=30000 visibility=[IntervallTempus==2]
Chart item=TempusChart period=M refresh=30000 visibility=[IntervallTempus==3]
Chart item=TempusChart period=Y refresh=30000 visibility=[IntervallTempus==4]

RRD4J CONF FILE

NADA! (all commented out - no special manual config)

PERSISTENCE FILE:

Strategies {
 everyMinute : "0 * * * * ?"
 everyHour : "0 0 * * * ?"
 everyDay : "0 0 0 * * ?"
 every15min : "*/15 * * * * ?"
 default = everyChange
}

Items {
TempusChart* : strategy = restoreOnStartup, everyChange  }

It’s not my work, it’s copied together from other people who shared their knowhow previously and maybe the above is helping you now.

Kurt

1 Like

I copied your example by adapting it to my items and i reinstalled the addon.
When I put a items group the graph disappears, when I put an item, the graphic appears but empty.
I use Snapshot 2.3 in windows, maybe it is some error?

Hi,

mmh. I believe I’m at the end of what would be further guidance for finding a solution :frowning:

To make sure:

  1. you did give the persistence service some time to log data and plot it?
  2. you are sure that the group config is correct?

the config I posted above definitely works on 2.3

Kurt

Finally works!!
I Installed openhabian, copy your example, select rrd4j in the system, and WORKSSS, maybe a problem with something in windows

Thank you very much for the time dedicated, great forum, great people

Great stuff and happy to hear this!
Please mark your threat as resolved and enjoy the data graphs :wink:

Kurt

Really glad you got it working. Linux all the way!!
Really stumped as to why it didn’t work before
Please mark the thread as solved

Hi Vincent,

a side question: How do you display the rest api in the main landing page?

Kurt

I run expert mode, maybe that’s why I have the REST api in the landing page.
Are you on simple, or standard mode?

mmh. I’m not really sure to be honest. I wasn’t aware about the expert mode :zipper_mouth_face:
standard (openhabian), I guess.
Kurt

In your conf/services folder there is a file called addons.cfg
It looks like this:

# The installation package of this openHAB instance
# Note: This is only regarded at the VERY FIRST START of openHAB
# Note: If you want to specify your add-ons yourself through entries below, set the package to "minimal"
# as otherwise your definition might be in conflict with what the installation package defines.
#
# Optional. If not set, the dashboard (https://<yourserver>:8080/) will ask you to choose a package.
#
# Valid options:
#   - minimal  : Installation only with dashboard, but no UIs or other add-ons. Use this for custom setups.
#   - simple   : Setup for using openHAB purely through UIs - you need to expect MANY constraints in functionality!
#   - standard : Default setup for normal users, best for textual setup
#   - expert   : Setup for expert users, especially for people migrating from openHAB 1.x
#   - demo     : A demo setup which includes UIs, a few bindings, config files etc.
#
# See http://docs.openhab.org/configuration/packages.html for a detailed explanation of these packages.
#
#package = minimal
...

Uncomment the #package=minimal and change it to package=standard
Restart OH

1 Like

One last question, I have a visual problem with the time periods of the graphics.

1- In the app I get all the graphics followed one below the other and although press the buttons (hour, week …) nothing happens since they are displayed all at the same time.

2- If I access by browser, all the graphics also appear one below the other but the time buttons do not appear

Hi,
I think you’ve got some errors with the mapping of the Switch in your sitemap
You shouldn’t see the switch visible on your browser screenshot.

nothing happens since they are displayed all at the same time.

What do you mean exactly? In the browser, you’d need to reload the page
The above code should give you sth like this, else you’re not persisting a group:

BTW, if someone reads this who can answer: Is there a way to clear the wrong data entry out of the RRD4J DB? (on 20th december one of my sensors recorded a temperature of 9999 °C, making the graph unreadable).

Here are some other periods you may try as well:


„h“ – 1 hour,
„4h“ – 4 hour,
„12h“ – 12 hour,
„D“ – 1 day,
„3D“ – 3 days,
„W“ – 1 week,
„2W“ – 2 weeks,
„M“ – 1 monht,
„2M“ – 2 Month
„4M“ – 4 Months
„Y“ – 1 Year.

Ok, the problem was that he had not defined the item, IntervallTempus :sweat:
Now, i have one graph, but to see another period of time I must press the button and refresh the page to change the graph, is it normal?
Regarding the graphic, for the moment it only records the value of kwh of a single room, so only one line comes out, in the future I will add more

he problem was that he had not defined the item

Cool that you found the issue!

I must press the button and refresh the page to change the graph, is it normal?

Not sure if this is normal, but I have the same when I’m using the browser (Chrome).
in the mobile app, it’s automatically refreshing.

Kurt

Check your browser autorefresh settings. It works for some browsers but I can’t remember which…