[SOLVED] InfluxDB openHAB stores no Data

     v
    g_INFLUX* : strategy = everyChange, everyHour, everyDay

versus

                                                                                     v
Number C2MW97   "Wirkleistung L1 [JS(WtoKW.js):%s]"     (StraBaWe2OGUVBF05, g_MYSQL, gINFLUX)   {modbus="C2MW97:0"}

So where is the Group definition? is it with underscore or without?

Quick note: Your everyHour+everyDay is redundant because the one includes the other :wink:

Second note: How is the group itself defined?

Third note: What is it, g_INFLUX or gINFLUX?

Forth note: The name choice is not good imho. You should use groups to organize Items based on their physical or logical nature. In the next step you can decide to have those persisted. In your example I’d rather define a group for “gWirkleistung”.

There is no documentation for that because it shouldn’t be needed normally. The steps are however part of the backup routine: http://docs.openhab.org/installation/linux.html#backup-and-restore

sudo systemctl stop openhab2
sudo rm -rf /var/lib/openhab2/cache/*
sudo rm -rf /var/lib/openhab2/tmp/*
sudo systemctl start openhab2
2 Likes
Group gMYSQL
Group gINFLUX

Sorry wrong copy pasta. both are gINFLUX

See above.

gINFLUX and gMYSQL are groups I use to persist Items.
Think of it like an on/off switch to persist an item.
Because I do have groups like Location, Electricity etc. but not all of them need to be stored.

Influx settings:

> settings
Setting           Value
--------          --------
Host              127.0.0.1:8086 (I just edited this so it does not display my real IP)
Username          openhab
Database          openhab_db
RetentionPolicy
Pretty            false
Format            column
Write Consistency all
Chunked           true
Chunk Size        0

Could this be a problem? Because there is nothing inside the field RetentionPolicy


The following sections cover how to create, alter, and delete retention policies. Note that when you create a database, InfluxDB automatically creates a retention policy named autogen which has infinite retention. You may rename that retention policy or disable its auto-creation in the configuration file.

Just testet my persist file with MySQL.
It seems like the following persist file is not working.

Strategies {
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"
    default = everyChange
}
Items {
      gMYSQL* : strategy = everyChange, everyDay, restoreOnStartup
}

But this one is working

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

Still there is this WARN message:

10:17:03.761 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'mysql.persist' has errors, therefore ignoring it: [1,1]: mismatched
 input '<EOF>' expecting 'Strategies'

10:17:03.772 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mysql.persist'

but it starts to persist stuff.

10:17:04.201 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL: Stored item 'C2MW97' as '740.05999755859375'[740.05999755859375] in SQL database
at 2017-09-05 10:17:04.2.

My thought.
There is a problem when trying to persist a group and its items.

I also noticed that MySQL is persisting but Influx is selected.

I tried to change the persistence restart openHAB.
Clear tmp and cache. Nothing so far seems to work.

but
 this means that the first character is being read wrong (?)
what text editor are you using to modify the *.persist files? (please don’t tell me Eclipse Smarthome Designer :stuck_out_tongue: )

I believe that this has to do with the default service that will be used for the rules (for statements like item.historicState).
If you have 2 persistence services configured, both will store the states.

Something is wrong with your influxdb.persist (and mysql.persist) file(s). Try to recreate it from scratch using vim.
I never had problems with my setup and I am persisting a lot of stuff in influxdb.

I have a gInfluxDB group and I add to that several members (other groups and/or individual items)

root@homer:~# more /etc/openhab2/persistence/influxdb.persist 
Strategies {
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"

    default = everyChange
}

Items {
    // persist all members of gInflux Group on every change
    gInfluxDB* : strategy = everyChange, everyHour, everyDay
}
1 Like

this shouldn’t be a problem since:
a) You already were able to store the sample data
b) By default it uses autogen
c) I have the same output from settings in my influx

Emacs :slight_smile:
my *.persist files are not wrong :cry: MySQL persist looks the same!

mysql.persist

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

influx.persist

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

you forgot the “db” part
 (unless the daemon of copy pasta hit your post)
I believe that you need to name it influxdb.persist. Did you try that ?

2 Likes

You @Dim ! Deserved yourself a :cookie: !!!

IT WAS THIS ONE SIMPLE THING

its influxdb.persist NOT influx.persist

CLOSED (FINALLY)

Thanks to @rlkoshak @ThomDietrich @Udo_Hartmann @justinwilczek @Dim
I want to thank you all!

3 Likes

(check the date on my reply above :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: )

3 Likes

:dagger: @Dim !
I did not realize this


2 Likes

no worries, now
 hit that InfluxDB hard !

(with some background music)

3 Likes

:smiley: Don’t take it too hard on yourself. We’ve all chased such a stupid little error for days at least a few times in our lives :smile:

1 Like

But Explanation would be good why openHAB loaded the influx.persist file but not use it?
Why ?

I think that openHAB2 will load any *.persist file that you put in that directory (even elias.persist)


but
 the config name(?) that it will load will not match a service/bundle/addon/whatever and it will not be effective.

It seems to me that the persistence addons are looking into the config entries in Karaf for settings.
If you load elias.persist, you will (should) have an elias service config (and not an influxdb service config)

2 Likes

I agree with your assessment, but shouldn’t there be at least a WARN level log statement if it doesn’t find an elias service to correspond with the .persist file? It seems misleading to me for OH to load the file, say it loaded the file, and then just silently ignore it.

2 Likes

Error checking was always one of the weak spots of the core.

2 Likes

Have chased this exact same “bug” all weekend.

Glad you found the solution :smiley: