OH2.4M8 in a docker container
Ubuntu 18.0.4 Server
I am using rrdj4 persistences for my Novelan heatpump. Displaying the values in graphs and so on is working. For further calculations which I want to do in Excel I would need to have the values exported to an Excel compatible form (CSV etc)
All my research is always leading to hints to use persistence instead of an excel export. But this is in my case not a solution.
Thanks for any help which is highly appreciated
You can try to use the rest api to read the rrd4j database. But not all data is saved, it will be compress. Maybe this Thread can give you a hint.
Hmm ok …
Is this addon somewhere on github? Maybe I can get an idea how to extract data from heatpump and do not take the detour through rrdj4 …
You can install the REST API docs from the Misc tab in PaoerUI. From there you can query rrd4j which will give you the values in JSON format. From there you will need to write your own script to convert the JSON to CSV. There is no CSV export built into OH or rrd4j.
so far the best hint (at least for me)
Is it possible to ask more than one itemnames at once in one request?
In which format is the time displayed in json output?
If it’s formatted it’s probably ISO 8601. If it’s just a big number it’s probably epoch.
after some hours of coding I wrote a python script which is doing the job!
It would be nice if you could share your script as I’m looking for a solution to export power consumption data to CSV.
Sorry for my late replay
### Reihenfolge der Daten:
### Datum / Aussentemperatur / Erdkollektortemperatur / Heizenergie / Warmwasserenergie /
from datetime import date, timedelta
from urllib.request import urlopen
heute = date.today()
gestern = date.today()-timedelta(days=1)
all_filenames = 
jahr = gestern.year
if ( gestern.month < 10 ):
monat = "0" + str(gestern.month)
monat = gestern.month
folderadd = str(jahr) + "-" + str(monat) +"/"
### URLs für die Heizdaten
URL1 = ["Aussentemp", "http://192.168.100.11:8060/rest/persistence/items/HeatPump_Temperature_1?starttime="]
URL2 = ["Erdkollektortemp", "http://192.168.100.11:8060/rest/persistence/items/HeatPump_Probe_in?starttime="]
URL3 = ["Heizenergie", "http://192.168.100.11:8060/rest/persistence/items/HeatPump_Thermalenergy_Heating?starttime="]
URL4 = ["WWenergie", "http://192.168.100.11:8060/rest/persistence/items/HeatPump_Thermalenergy_Warmwater?starttime="]
URL5 = ["Gesamtstrom", "http://192.168.100.11:8060/rest/persistence/items/HeizstromGesamt?starttime="]
addend = str(gestern) + '&endtime=' + str(heute)
URLS = [URL1, URL1+addend, URL2, URL2+addend, URL3, URL3+addend, URL4, URL4+addend, URL5, URL5+addend]
TEMP_PATH = "/home/homer/heizungsloggen/temp/"
SAVE_PATH = "/home/homer/heizungsloggen/logs/" + folderadd
SAFETY_PATH = "/media/daten/DOKUMENTE/LEITZORDNER/HAUS/00Heizungslogs/" + folderadd
data = json.loads(urlopen(url).read())
for i in range(0,9,2):
if __name__ == '__main__':
It can be that some imports are obsolete because I deleted some unimportant code parts
Thanks for sharing your script.
Could you tell me where you are calling it from or how it can be referenced? From a personal widget?
I would also be interested to know if this visually shows the .csv downloaded through the browser or if instead it is generated in a file within the server.
Thank you very much, greetings.
As far as I read the script it can be called standalone from the command line.
It would be possible to call it by using the exec binding or executecommandLine.
The extracted values are saved to a file ( call to write_csv ).