[SOLVED] Pulse Counter Item Help rrd4j persistence and charting?

  • Platform information: RPi3

    • OS: Raspbian Linux 8 jessie
    • openHAB version: openHABian 2.2.0-1
  • Issue of the topic: please be detailed explaining your issue
    I want to track the RPM of a fan. I have the device setup and sending the RPM every Minute via MQTT.
    The item shows the correct RPM in Basic UI but the reported data points are not persisting.

    • Items configuration related to the issue
Number  ESP_C2C4A3 "Pulse Counter 1" (OEE) {mqtt="<[broker:ESP_C2C4A3/PC01/Count:state:default]" }

  • rrd4j.cfg Services configuration related to the issue

Strategies {
    everyMinute:"0 * * * * ?"
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"
default = everyMinute
Items {
ESP_C2C4A3 : strategy = everyMinute, restoreOnStartup
OEE* : strategy = everyChange, restoreOnStartup

No Errors are showing in the logs for this.
Any help on this would be greatly appreciated.

(just a quick check) is your persistence file named correctly?

it should be: /etc/openhab2/persistence/rrd4j.persist

note that you are doubling the storing of the values on item ESP_C2C4A3 since it is also a member of the OEE group.

Also: The strategy on the Group should use everyMinute since you are using rrd4j

I don’t personally use rrd4j (influxdb is so much better :stuck_out_tongue:) , so I may be wrong here but… is this correct?

maybe it should be (0 for MIN):


Hi Angelos

Thanks for the input.
Confirmed the file is named rrd4j.persist
I tried changing the first U to 0 as recommended but that didn’t seem to help.
I un-installed and reinstalled the rrd4j service.
I removed the item from the OEE group. I removed the ESP from the the persist items.
Nothing seems to work. I’m going to try using influxdb but I’m not the best at working with databases so wish me luck.

1 Like

Hi Angelos

So I’m trying to use Influx and I’ve followed the instructions but I’m getting an error.
Any idea what I might be doing wrong?

2018-05-30 13:17:56.151 [ERROR] [.internal.InfluxDBPersistenceService] - database connection failed

	at retrofit.RetrofitError.networkError(RetrofitError.java:27) ~[223:org.openhab.persistence.influxdb:1.12.0]

	at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:395) [223:org.openhab.persistence.influxdb:1.12.0]

	at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240) [223:org.openhab.persistence.influxdb:1.12.0]

	at org.influxdb.impl.$Proxy142.ping(Unknown Source) [223:org.openhab.persistence.influxdb:1.12.0]

	at org.influxdb.impl.InfluxDBImpl.ping(InfluxDBImpl.java:114) [223:org.openhab.persistence.influxdb:1.12.0]

	at org.openhab.persistence.influxdb.internal.InfluxDBPersistenceService.checkConnection(InfluxDBPersistenceService.java:172) [223:org.openhab.persistence.influxdb:1.12.0]

	at org.openhab.persistence.influxdb.internal.InfluxDBPersistenceService.activate(InfluxDBPersistenceService.java:145) [223:org.openhab.persistence.influxdb:1.12.0]

2018-05-30 13:17:56.247 [ERROR] [.internal.InfluxDBPersistenceService] - database connection error Unrecognized SSL message, plaintext connection?

2018-05-30 13:17:56.251 [ERROR] [.internal.InfluxDBPersistenceService] - database connection does not work for now, will retry to use the database.

2018-05-30 13:18:07.806 [ERROR] [org.influxdb.impl.BatchProcessor    ] - Batch could not be sent. Data will be lost

Why did you set the step size to 3600? IMHO the size has to be 60 for 60 seconds in order to have a value for each minute.

post your /etc/openhab2/services/influxdb.cfg

Sorry I don’t know why I didn’t think to do that.
Here is the cfg below that is the influxdb.persist

# The database URL, e.g. or .
# Defaults to:
# url=http(s)://<host>:<port>


# The name of the database user, e.g. openhab.
# Defaults to: openhab


# The password of the database user.


# The name of the database, e.g. openhab.
# Defaults to: openhab


Strategies {
    everyMinute:"0 * * * * ?"
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"

    // if no strategy is specified for an item entry below, the default list will be used ,TemperatureOutside, ESP_B72224
default = everyChange

Items {
ESP_C2C4A3 : strategy = everyUpdate, restoreOnStartup

Here is the database name and user as seen from influxdb cli.

why https?
try http

I had tried http but it didn’t seem to work but I think that might have been due to me changing the IP to match the IP of the Pi and not the loopback.

However it’s odd I see it’s showing 271 data points but I didn’t think it was working 271 minutes ago and I think it should only be recording once a minute.

it’s storing every single change of the item ESP_C2C4A3 state.
How often does the ESP report to MQTT its state?

Once a minute or every 60 seconds.
But since I changed it to HTTP it’s not giving me any errors so I believe that fixed it thanks so much for all your help.

1 Like

One last question.
Have you used Grafana? If so do you have any advice on how to set that up? Should I install that on the same server as Openhab or just do a seperate install on the client PC?

check this out: InfluxDB+Grafana persistence and graphing

(same host = OH2 + InfluxDB + Grafana)

also: after you get it up an running, disable extra logging: InfluxDB+Grafana persistence and graphing

Perfect thanks again. :+1:

1 Like

Hi Jurgen
I’m not sure I should have used 3600 but I only wanted a reading to be plotted every hour.
It’s my understanding everyMinute must be used or no data will be stored using rrd4j.

Use the 60 for step and set the stepS in the archive to 60, for keeping 60 minute values.
Have fun with influxdb and Grafana. I had a look into those but kept rrd4j because it doesn’t take that much of resources.