OpenHAB - MQTT how to save to Influxdb (config by paperUI)

  • Platform information:
    • OS: Windows Server 2012
    • Java Runtime Environment: zulu-8
    • openHAB version: OpenHAB version 2.5.6
  • MQTT : mosquitto
  • InfluxDB: 1.8.0
  • Grafana 7.0.5

Hello, my problem is with the Influxb Grafana notation.
I have no problem with saving the Items status by OpenHab (because I have them in tems.
But I have a temperature reading with MQTT paperUI

I know I don’t have the Items MQTT configuration file …
Since I have configured MQTT by paper UI

How to save data from openhab to Influxdb …
on event.log
i have
2020-07-19 19:36:46.004 [vent.ItemStateChangedEvent] - mqtt_topic_ParterTemp_czujnik_garaz changed from 37.63 to 37.69
2020-07-19 19:36:58.744 [vent.ItemStateChangedEvent] - mqtt_topic_ParterTemp_czujnik_wiatrolap changed from 22.50 to 22.56
2020-07-19 19:36:58.745 [vent.ItemStateChangedEvent] - mqtt_topic_ParterTemp_czujnik_kotlownia changed from 22.13 to 22.06

Just configure the persistence as you also would with manually created items. Bet practice would be: Put all your items that should be stored in influx into a group called e.g. gPersistence and persist this group.
You can assign groupd to items in PaperUI as well

So in Paper UI

Configuration/Thins/Temp i have
sensor_room/ mqtt:topic:sensor_room

that is, the item should look like

Number sensor_room “room Temperature” {channel=“mqtt:topic:sensor_room”}

It doesn’t work like I wrote earlier … I think it’s better
set up MQTT 1.x and work. on configuration files, not PAPER UI.
PAPER UI double work confection PAPER UI and then at night manually items - somehow it looks pointless.

You also can use mqtt2 with item files. But why is your item not working? What error do you get?

I have no errors. The items I have in the xxxx.items files are written to the database. Only MQTT is not saved because I do not have MQTT item in the file.

For my part, it should just work, since mqtt changes in the Event file, it should be written to influxdb. Rather, I have to focus on mqtt1x because there are manuals up to 2.0 I don’t know how to configure using files.

Unless there is an option to configure via paper UI. But now I have no idea how to do this ITEMS revocation

If you click on the blue circle of your mqtt channel ( for example “salontemp”) the linked item name will be shown! You can use this item-name in the.persist file.

1 Like

The problem is the simple mode, I guess.
As far as I know the item names aren’t shown then.
@Martin_Rudowicz1:Try disabling the simple mode as explained here and then you also see the items in the navigation on the left side.

1 Like

Ups, I didn’t know that one! Thanks for stepping iun.

I change Simple mode ande now i see item
but stli not workin

So how shoult look like file items. nothing change and dont save data to Influs

Not sure what you’re expecting to happen.
Nothing gets persisted unless you ask for it.
You would need to install an influxdb instance.
Then you can install the openHAB influxdb persistence add-on.
Next you configure the influxdb,cfg file to connect to your instance.
Lastly you configure influxdb.persist file for the Items you want to store, such as mqtt_topic_ParterTemp_czujnik_garaz, and when to store.

But i have influxdb… All items i have in Influx but dont have Items from MQTT becaus that was done in (MQTT) in Paper UI… All item what i have in config works fine…
My peristence is

Strategies {
everyMinute : “0 * * * * ?”
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”
}
Items {
* : strategy = everyChange, everyMinute
}

One thing thaht comes to my mind reading this.
Sometimes the persistence needs to be restarted when adding items in order to know about the new items.
So can you try and reboot openHAB and check if it is working then?
Additionally: Do you really want to store the item value every minute even if it is not changing? That only fills up the database with obsolete data

This should persist all Items.

Persistence is really a legacy OH 1.x service, not very dynamic. So “all Items” really means all Items that existed when the service loaded.
But I would expect that you have rebooted or restarted since your Items were created, so they should have been included.

What makes you think your MQTT Items like mqtt_topic_ParterTemp_czujnik_garaz are not being persisted?

I would not expect Items Salon_jadalnia1 and 2 to be persisted, as I would guess they never get a value. The channel links you defined in your czujniki.items file are invalid.

I do not care aboutr *.presisted. I willa change thant … Only what I need i for what i sart topic hot to create Items for MQTT…

Early i have simple link i change that but nothing reaLLY CHANGE.

Ok please one step back.
It is hard to understand what exactly your problem ist. So can you explain your problem completely
Where and how are the items configured?
Do you see the items in your sitemap or Habpanel?
Do they show the correct values?
What does the log say if an item value changes?

Only then take care about adding them to persistence. I believe that your items do not get updated (as @rossko57 also assumed) and therefore they are not persisted since they are NULL or UNDEFINED

And then, how do you check if the items are persisted?
Influx command line?
Grafana?

This is an update of an Item named mqtt_topic_ParterTemp_czujnik_garaz
Because this Item gets a meaningful value, it should get persisted.

These are definitions for completely different Items named Salon_jadalnia1 and Salon_jadalnia2

I do not think they will work, because the channel definitions look faulty to me.
I expect that means they never get updated to sensible values.
Can you see them getting updated in your events.log?

If they do not get updated to sensible values, then are no sensible values to be persisted, and these Items will not be persisted.
That is how it is supposed to work.