TL;DR: What is the openHAB way to persist an item value only when it changed significantly?
-
Platform information:
- Hardware: Raspberry Pi 3
- OS: Raspbian Jessie
- Java Runtime Environment: oracle-java-jdk 1.8.0_65
- openHAB version: 2.1.0
-
My general background: I’m beginner on openHAB, currently evaluating version 2.1 with no experience on version 1. I’m active user of FHEM for a few years. My hardware setup contains heterogenous components including thermo-/hygrometers (TFA), power outlets (Intertechno) and heating control (MAX!, eBUS). I’m software developer with few experiences in Perl and a heavy background in Java, thus openHAB looks promising to me.
-
My first openHAB project: I’m trying to integrate thermo-/hygrometers. I have 16 sensors that transmit their state (temperature, humidity, battery and rssi) about every 10 seconds. The signal is received by a linux daemon which creates a JSON message and publishes it per MQTT. FHEM and openHAB are subscribers to the respecting MQTT topics.
-
My problem: the item values often change within a very small range (0.1 °C / 2%). This is no problem for UI display, but I don’t want to persist all those small changes. I chose and prefer persistence strategy
everyChange
, and I don’t want to switch to a fix time-based strategy because that would require a lot of disk space. I’d like to set a persistence strategy that accepts every change > 0.2 °C or every change > 3%, a combination of every change wih a threshold. FHEM allows such a setting. -
My efforts: I’ve searched for solutions, all I found is a thread where the supposed solution is the combination of a dummy item and a rule. I don’t prefer this solution because in my case that would be 16 dummy items and maybe 16 rules (I don’t hope so, didn’t dive into rules until now). I saw a method
deltaSince
that can be used in rules, but didn’t find a way to make persistence depend on a rule.
What is the openHAB way to solve my problem? Is there something like a persistence filter or pre-processing phase? Or is it possible for an average user to add a persistence strategy?