[SOLVED] InfluxDB not working

Hi guys,

I wanted to update to the newest OpenHab version and thus thought it would be the right time to also update the a newer Raspberry PI 4. Now, I used the openhabian image and configured everything using the installer, including grafana and influxdb.

Both are running smoothly, but I dont get OpenHab to persist any values in influxdb. I know there are multiple threads about this topic but none of them that I found could help me to fix the issue. What I’ve already tried:

  • Restart OpenHab
  • Stop OpenHab / Clean Cache (cache & tmp) / Start OpenHab
  • Reinstalled influxdb addon via Paper UI
  • Verified the influxdb.cfg and influxdb.persist files (see below)
  • Verified access rights on files

I dont get it. I also compared the configuration to my current system and there are no differences. I would be happy about any ideas, what else I could check. Thanks!

File persistence/influxdb.persist

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

Items {
    Temperatur*      : strategy = everyMinute
    Luftfeuchte*     : strategy = everyMinute
    Thermostat*      : strategy = everyMinute,everyChange
    Helligkeit*      : strategy = everyMinute
    Rauchmelder*     : strategy = everyHour,everyChange
    FensterSensor*   : strategy = everyHour,everyChange
}

File services/influxdb.cfg

url=http://localhost:8086
user=<myuser>
password=<mypassword>
db=openhab_db
retentionPolicy=autogen

Put the InfluxDB add-on into debug logging.

Watch InfluxDB’s log file for errors.

The InfluxDB Debug Logging does not seem to contain errors:

2020-02-19 00:28:37.083 [DEBUG] [org.apache.felix.configadmin        ] - Adding configuration org.openhab.influxdb
2020-02-19 00:28:43.755 [DEBUG] [org.apache.felix.configadmin        ] - getConfiguration(pid=org.openhab.influxdb, location=null)
2020-02-19 00:28:43.756 [DEBUG] [org.apache.felix.configadmin        ] - Found cached configuration org.openhab.influxdb bound to null
2020-02-19 00:28:44.947 [DEBUG] [org.osgi.framework.ServiceEvent     ] - ServiceEvent REGISTERED - {org.openhab.core.karaf.internal.FeatureInstaller, org.osgi.service.cm.ConfigurationListener}={package=minimal, service.id=234, service.bundleid=160, service.scope=bundle, binding=astro,enocean,harmonyhub,heos,homematic,hue,network,samsungtv,somfytahoma,weather1,zigbee, persistence=influxdb,mapdb, transformation=map, component.name=org.openhab.addons, service.config.label=Add-on Management, component.id=104, ui=basic,paper,dashboard,, service.config.category=system, service.config.description.uri=system:addons, service.pid=org.openhab.addons}
2020-02-19 00:28:47.759 [DEBUG] [pse.xtext.util.OnChangeEvictingCache] - Clear 24 cache entries for resource tmp_influxdb.persist after 41 hits and 24 misses (quota: 63%)
2020-02-19 00:28:47.761 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'influxdb.persist'
2020-02-19 00:28:48.706 [DEBUG] [org.osgi.framework.ServiceEvent     ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.core.ConfigOptionProvider, org.eclipse.smarthome.core.persistence.PersistenceServiceRegistry}={service.id=256, default=influxdb, service.bundleid=181, service.scope=bundle, service.config.category=system, service.pid=[org.eclipse.smarthome.persistence, org.eclipse.smarthome.persistence], service.config.label=Persistence, component.name=org.eclipse.smarthome.core.persistence.internal.PersistenceServiceRegistryImpl, service.config.description.uri=system:persistence, component.id=137}
2020-02-19 00:29:02.047 [DEBUG] [mpl.info.InfoBundleTrackerCustomizer] - Ignore incorrect info null provided by bundle org.openhab.persistence.influxdb
2020-02-19 00:29:02.055 [DEBUG] [org.apache.felix.configadmin        ] - listConfigurations(filter=(|(service.factoryPid=org.openhab.influxdb)(service.factoryPid=org.openhab.influxdb|org.openhab.persistence.influxdb)(service.factoryPid=org.openhab.influxdb|org.openhab.persistence.influxdb|1.14.0)(service.factoryPid=org.openhab.influxdb|org.openhab.persistenceinfluxdb|1.14.0|mvn:org.openhab.persistence/org.openhab.persistence.influxdb/[1.14.0,1.15\))))
2020-02-19 00:29:02.056 [DEBUG] [org.apache.felix.configadmin        ] - Listing configurations matching (|(service.factoryPid=org.openhab.influxdb)(service.factoryPid=org.openhab.influxdb|org.openhab.persistence.influxdb)(service.factoryPid=org.openhab.influxdb|org.openhab.persistence.influxdb|1.14.0)(service.factoryPid=org.openhab.influxdb|org.openhab.persistence.influxdb|1.14.0|mvn:org.openhab.persistence/org.openhab.persistence.influxdb/[1.14.0,1.15\)))
2020-02-19 00:29:02.058 [DEBUG] [org.apache.felix.configadmin        ] - listConfigurations(filter=(|(service.pid=org.openhab.influxdb)(service.pid=org.openhab.influxdb|org.openhab.persistence.influxdb)(service.pid=org.openhab.influxdb|org.openhab.persistence.influxdb|1.14.0)(service.pid=org.openhab.influxdb|org.openhab.persistence.influxdb|1.14.0|mvn:org.openhab.persistence/org.openhab.persistence.influxdb/[1.14.0,1.15\))))
2020-02-19 00:29:02.061 [DEBUG] [org.apache.felix.configadmin        ] - Listing configurations matching (|(service.pid=org.openhab.influxdb)(service.pid=org.openhab.influxdb|org.openhab.persistence.influxdb)(service.pid=org.openhab.influxdb|org.openhab.persistence.influxdb|1.14.0)(service.pid=org.openhab.influxdb|org.openhab.persistence.influxdb|1.14.0|mvn:org.openhab.persistence/org.openhab.persistence.influxdb/[1.14.0,1.15\)))
2020-02-19 00:29:02.064 [DEBUG] [org.apache.felix.configadmin        ] - Adding configuration org.openhab.influxdb
2020-02-19 00:29:02.067 [DEBUG] [org.apache.felix.configadmin        ] - Registering service [org.osgi.service.cm.ManagedService, id=403, bundle=247/mvn:org.openhab.persistence/org.openhab.persistence.influxdb/[1.14.0,1.15)]
2020-02-19 00:29:02.579 [DEBUG] [org.osgi.framework.ServiceEvent     ] - ServiceEvent REGISTERED - {org.openhab.core.persistence.PersistenceService, org.openhab.core.persistence.QueryablePersistenceService}={service.id=404, service.bundleid=247, service.scope=bundle, user=openhab, url=http://127.0.0.1:8086, component.name=org.openhab.persistence.influxdb, component.id=255, password=<mypassword>, retentionPolicy=autogen, service.pid=org.openhab.influxdb, db=openhab_db}

Also on the InfluxDB side no errors in the log file. :frowning:

When I change any configuration value to a wrong value, the logging throws me connectivity errors. So I assume that the connection to the influxdb is established without errors.

My influxdb never worked from day one, log shows no errors here too… in the end I gave up.

EDIT: not very helpful, but just to bring comfort that you are not alone. ps. my solution was to go mysql, thus I never bothered to chase the issue further.

Hi, did I get that right that you already have a running openHAB-system /w influxdb & Grafana?

I never used openHABian (I virtualized Debian Buster /w openHAB + influxdb/grafana on a different VM), but anyway something you could try;

Login to influxdb-CLI (if that doesn’t work, make sure that influxd process is running properly):

influx

Create a new database:

CREATE DATABASE "openHAB_data"

Sidenote - for reference, if you’re planning more than one RP (retention policy).

Create a new user:

CREATE USER openHAB_user WITH PASSWORD 'secret'

Grant Write:

GRANT WRITE ON "openHAB_data" TO "openHAB_user"

Adjust your .cfg:

url=http://localhost:8086
user=openHAB_user
password=secret
db=openHAB_data
retentionPolicy=autogen

That ‘autogen’ RP is automatically created with the above mentioned CREATE DATABASE statement, so no worries.

I strongly suggest to add an dedicated admin-user in influxdb (but let’s get your setup running first!);

CREATE USER Stefan WITH PASSWORD 'ultra_secret' WITH ALL PRIVILEGES

Afterwards you need to alter your CLI-command in order to do stuff;

influx -username Stefan -password ultra_secret

As a closing note - you could consider installing Chronograf for a light-weight (GUI-based) data-exploration tool (I absolutely love it).

Further logs from influxdb debug logging:

08:30:17.635 [DEBUG] [l.InfluxDBPersistenceServiceActivator] - InfluxDB persistence bundle has been started.
08:30:17.652 [DEBUG] [b.internal.InfluxDBPersistenceService] - influxdb persistence service activated
08:30:17.947 [DEBUG] [b.internal.InfluxDBPersistenceService] - database status is OK, version is 1.7.9

Nothing else happens, even when I change values in OpenHab for configured Items. So it seems to me, that the addon is not receiving updates…

Any hints on that?

I used the script to verify that I can push data to influx using the configured credentials:

The sine-wave values are stored and available in influx & grafana, therefore, the issue nails down to somewhere what I excepted above: Openhab & InfluxDB Addon dont push data. This is confirmed by not seeing any trace logs from the addon which I would expect when data is pushed… nothing. It’s like it is not installed…

So now I have changed my influxdb.persist file to:

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

Items {
    Thermostat_Bad   : strategy = everyChange, everyMinute
}

And the things get pushed to influx and show up in Grafana. So the * selection does not seem to work, what am I missing?

Okay, getting closer:

<groupName>* - all members of this group will be persisted, but not the group itself. If no strategies are provided, the default strategies that are declared in the first section are applied. Optionally, an alias may be provided if the persistence service requires special names (e.g. a table to be used in a database, a feed id for an IoT service, etc.) Note that * is NOT a wildcard match character in this context.

I misunderstood the syntax. I need to recreate the groups on my new system…

Can you provide the items that are linked to the to-be-persisted groups?

As an example;

Strategies {
    everyMinute         :   "0 * * * * ?"
    default             =   everyChange
}

Items {
    gMQTT_persistence*              :   strategy = everyMinute, restoreOnStartup
}
Number      MQTT_ws1_CO_Conc         "WS1 CO [%.4f mg/m³]"       <airquality_carbdio_static>         (gMQTT, gMQTT_persistence)       { channel="mqtt:topic:wetterstation:co_conc" }
1 Like

I solved the issue by putting back in place the groups mentioned. So the overall configuration looks like this:

Klima.items

// Virtual Groups for Influx DB
Group TemperaturSensor "Temperatursensoren"
Group LuftfeuchteSensor "Relative Luftfeuchtigkeitssensoren"
Group ThermostatSensor "Raumthermostatsensoren"
Group HelligkeitSensor "Helligkeitssensoren"
Group RauchmelderSensor "Rauchmeldesensoren"
Group OeffnungSensor "Öffnungssensoren"

Number Luftfeuchte_Bad "Luftfeuchte [%.1f %%]" <humidity> (Bad,LuftfeuchteSensor) [Sensoren] {channel="homematic:HmIP-BWTH:PEQ2215777:000C9A4999EE49:1#HUMIDITY"}
Number Temperatur_Bad "Temperatur [%.1f °C]" <temperature> (Bad,TemperaturSensor) [Sensoren] {channel="homematic:HmIP-BWTH:PEQ2215777:000C9A4999EE49:1#ACTUAL_TEMPERATURE"}
Number Thermostat_Bad "Thermostat [%.1f °C]" <temperature> (Bad,ThermostatSensor) [Sensoren] {channel="homematic:HmIP-BWTH:PEQ2215777:000C9A4999EE49:1#SET_POINT_TEMPERATURE"}

Number Temperatur_Aussen_Max "Außentemperatur (max) [%.1f °C]" <temperature> (Garten,TemperaturSensor) [Sensoren] {weather="locationId=home, forecast=0, type=temperature, property=max"}
Number Temperatur_Aussen_Min "Außentemperatur (min) [%.1f °C]" <temperature> (Garten,TemperaturSensor) [Sensoren] {weather="locationId=home, forecast=0, type=temperature, property=min"}

persistence/influxdb.persist

Strategies {
    every5Minutes    : "0 */5 * * * ?"
    everyHour        : "0 0 * * * ?"
    everyDay         : "0 0 0 * * ?"

    default          = everyChange
}

Items {
    TemperaturSensor*  : strategy = everyChange, every5Minutes
    LuftfeuchteSensor* : strategy = everyChange, every5Minutes
    ThermostatSensor*  : strategy = everyChange, every5Minutes
    HelligkeitSensor*  : strategy = everyChange, every5Minutes
    RauchmelderSensor* : strategy = everyChange, every5Minutes
    OeffnungSensor*    : strategy = everyChange, every5Minutes
}

I missed to copy over the groups from my old system and my misunderstanding was, that the persist file configuration is based on Item name pattern matching, while the syntax refers to groups that need to be available in openhab.

Thanks anyways for all your help. :slight_smile: