Persistence and calculations

I’m rather new to OpenHAB(2.3); I have persistence on InfluxDB with Grafana. It’s logging my temperatures.
What I would like to see is the difference between the outside and inside temperature.
I probably want to make a rule of it, but I have not ventured in that part of OH.
So how can I show a graph line with the difference between two temperatures?

  1. In Grafana - It doesn’t seem to be able to do calculations. Perhaps anyone can give me an example of a smart query?
  2. In Persistance extensions - The extensions mentioned in the doc are mostly related to do calculations on a single value and it’s previous values. Anything I’m not seeing here?
  3. Make a rule that creates a new Item - I have no idea how to do this or if this is even possible.

Any help or pointers appreciated.


If you want to show 2 ore more items/lines in a chart

But if you want to see the difference between two items, you have to build this value in a rule (Time cron oder change of the base-items triggered) and store in a new separate (persisted) item.

When using Grafana, certainly you can calculate the difference. Unfortunately I’m not at home and can’t reach my System, but I will take a look and give a hint tomorrow :wink:


Sorry, have to correct my statement… Actually, what I did was to stack two measurements (one with math(*-1) to mark the difference, but in my case it’s not temperature but energy harvesting… so I have no negative measurement, this is very different with temperatures :slight_smile: of course you could change the temperature to kelvin and do the stacking on the changed measurement, but it would be much easier to do the math within openHAB and store the difference in an extra item which is also persisted.