Hi all,
I’ve noticed that the OH3 persistence service doesn’t seem to be logging all events in the database.
Setup is as follows:
OpenHAB 3.3.0 running in a Docker container on Synology
Mosquitto running as native app on same Synology
MariaDB 10 running as native app on same Synology
InfluxDB 2 running in a Docker container on same Synology
I have two persistence services set up, one for MariaDB and one for InfluxDB (the latter for testing to see if this is an issue with MariaDB specifically or with the persistence functionality more generally). Both persistence services are set to log on ‘everyUpdate’.
I have a custom made temperature sensor that logs the temperature every 2 minutes via MQTT. I have a thing (Generic MQTT Thing via the binding) set up for the sensor with an Item linked to the temperature channel.
When I use a PC-based MQTT client I can see that the sensor is correctly delivering payloads to the MQTT broker at 2 minute intervals. When I look in the OpenHAB event log, I can see that it is also picking up the same temperature readings every 2 minutes as ItemStateChangeEvent for the temperature Item.
However, when I look in MariaDB it is missing a lot of the temperature changes and has only recorded about half of them (and to confirm, there have been actual changes in the temperature reading so it should have logged them, even if I wasn’t using ‘everyUpdate’).
I find the same thing in InfluxDB and it has logged the same temperature readings as MariaDB (or to look at it another way, it has missed the same readings as MariaDB did).
Something else I’ve noticed is that the timestamp of the data items in MariaDB are anywhere from 4 to 14 seconds after the data was logged in the OpenHAB event log. It also appears to have logged one item twice, the second instance a minute after the first. There appears to be the same issue in InfluxDB too (including the duplicate log item).
I have also checked a couple of different Thing and Item types, and they also have the same issue.
So from this it looks like:
- It’s not a problem with the sensor
- It’s not a problem with MQTT
- It’s not a problem with the Thing or the Item configuration or type
- It’s not a problem with the OpenHAB MQTT binding
- It’s not a problem specifically with MariaDB
- It’s not a problem specifically with InfluxDB
This means that it’s most likely either a problem with the persistence service in OpenHAB, or something else that affects MariaDB and InfluxDB, or something to do with my Synology/Docker setup (or something else I’ve not thought of). My Synology is pretty well specified and the Docker containers do not seem to be short of RAM or CPU allocation.
I’m not sure where next to look to solve this issue, or whether or not it’s a known problem. Happy to provide any further config data that’s useful.
Thanks in advance for your thoughts and suggestions.
B.