I’m also trying to move into influxdb from rrd4j.
When I try your script, it seems that my item data is empty?
Is it possible that it has something to do with the timezone? I guess I’ve got the +2 in the timeframe wrong?
I’m running openHAB 2.5.9 on Ubuntu 20
The config file:
#!/bin/bash
# openHAB server
openhabserver="192.168.0.10"
openhabport="8080"
serviceid="rrd4j"
# InfluxDB server
influxserver="192.168.0.18"
influxport="8086"
influxdatbase="openhab"
influxuser="admin"
influxpw="admin"
importsize=100
sleeptime=5
When I run it with an existing item:
./rest2influxdb.sh fluksoGasA
### timestamps
item: fluksoGasA
10y: 2010-10-11T12:48:00+02:00
1y: 2019-09-13T12:48:00+02:00
1m: 2020-09-12T12:48:00+02:00
1w: 2020-10-04T12:49:00+02:00
1d: 2020-10-10T12:49:00+02:00
8h: 2020-10-11T04:49:00+02:00
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 338 100 338 0 0 56333 0 --:--:-- --:--:-- --:--:-- 67600
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 338 100 338 0 0 67600 0 --:--:-- --:--:-- --:--:-- 67600
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 338 100 338 0 0 67600 0 --:--:-- --:--:-- --:--:-- 67600
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 338 100 338 0 0 84500 0 --:--:-- --:--:-- --:--:-- 110k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 338 100 338 0 0 84500 0 --:--:-- --:--:-- --:--:-- 84500
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 338 100 338 0 0 84500 0 --:--:-- --:--:-- --:--:-- 84500
### found values: 0
### delete temporary files
When I open the rest api in a browser:
http://192.168.0.10:8080/rest/persistence/items/fluksoGasA
{"name":"fluksoGasA","datapoints":"349","data":[{"time":1602326880000,"state":"301.0"},{"time":1602327120000,"state":"301.0"},{"time":1602327360000,"state":"301.0"},{"time":1602327600000,"state":"301.0"},{"time":1602327840000,"state":"301.0"},{"time":1602328080000,"state":"301.0"},{"time":1602328320000,"state":"301.0"},{"time":1602328560000,"state":"301.0"},{"time":1602328800000,"state":"301.0"},{"time":1602329040000,"state":"301.0"},{"time":1602329280000,"state":"301.0"},{"time":1602329520000,"state":"301.73333333333335"},{"time":1602329760000,"state":"25907.507738095235"},{"time":1602330000000,"state":"18144.0"},{"time":1602330240000,"state":"18144.0"},{"time":1602330480000,"state":"18144.0"},{"time":1602330720000,"state":"18144.0"},{"time":1602330960000,"state":"9573.266666666666"},{"time":1602331200000,"state":"712.0"},{"time":1602331440000,"state":"712.0"},{"time":1602331680000,"state":"712.0"},{"time":1602331920000,"state":"712.0"},{"time":1602332160000,"state":"712.0"},{"time":1602332400000,"state":"712.0"},{"time":1602332640000,"state":"712.0"},{"time":1602332880000,"state":"712.0"},{"time":1602333120000,"state":"712.0"},{"time":1602333360000,"state":"35622.183333333334"},{"time":1602333600000,"state":"35769.229166666664"},{"time":1602334320000,"state":"18923.0"},{"time":1602334560000,"state":"29591.33863636364"},{"time":1602334800000,"state":"19000.0"},{"time":1602335040000,"state":"19000.0"},{"time":1602335280000,"state":"19000.0"},{"time":1602335520000,"state":"28950.55"},{"time":1602335760000,"state":"29409.0"},{"time":1602336000000,"state":"29409.0"},{"time":1602336240000,"state":"29409.0"},{"time":1602336480000,"state":"35824.183333333334"},{"time":1602336720000,"state":"47679.0"},{"time":1602336960000,"state":"47679.0"},{"time":1602337200000,"state":"47679.0"},{"time":1602337440000,"state":"29666.344444444443"},{"time":1602337680000,"state":"64492.0"},{"time":1602337920000,"state":"64492.0"},{"time":1602338160000,"state":"64492.0"},{"time":1602338400000,"state":"56264.17283950617"},{"time":1602338640000,"state":"47654.458333333336"},{"time":1602338880000,"state":"46705.0"},{"time":1602339120000,"state":"46705.0"},{"time":1602339360000,"state":"35259.75"},{"time":1602339600000,"state":"43576.17222222222"},{"time":1602339840000,"state":"37975.0"},{"time":160234
I guess it’s linked with the timezone format.
With the +2 (timezone)
http://192.168.0.10:8080/rest/persistence/items/fluksoGasA?serviceId=rrd4j&starttime=2020-10-11T05:18:53+2
{"error":{"message":"2020-10-11T05:18:53 2 is not in a valid format.","http-code":500,"exception":{"class":"java.lang.IllegalArgumentException","message":"2020-10-11T05:18:53 2 is not in a valid format.","localized-message":"2020-10-11T05:18:53 2 is not in a valid format.","cause":"java.time.format.DateTimeParseException"}}}
without the +2
http://192.168.0.10:8080/rest/persistence/items/fluksoGasA?serviceId=rrd4j&starttime=2020-10-11T05:18:53
{"name":"fluksoGasA","datapoints":"111","data":[{"time":1602386400000,"state":"17634.0"},{"time":1602386640000,"state":"17634.0"},{"time":1602386880000,"state":"22724.243537414965"},{"time":1602387120000,"state":"18306.74166666667"},{"time":1602387360000,"state":"17995.504166666666"},{"time":1602387600000,"state":"17904.44166666667"},{"time":1602387840000,"state":"17802.279166666667"},{"time":1602388080000,"state":"17732.433333333334"},{"time":1602388320000,"state":"17670.487906504066"},{"time":1602388560000,"state":"17610.80416666667"},{"time":1602388800000,"state":"17589.1"},{"time":1602389040000,"state":"17590.0"},{"time":1602389280000,"state":"17590.0"},{"time":1602389520000,"state":"17590.0"},{"time":1602389760000,"state":"2995.0"},{"time":1602390000000,"state":"910.0"},{"time":1602390240000,"state":"910.0"},{"time":1602390480000,"state":"910.0"},{"time":1602390720000,"state":"910.0"},{"time":1602390960000,"state":"21612.05576923077"},{"time":1602391200000,"state":"19635.0"},{"time":1602391440000,"state":"6663.0"},{"time":1602391680000,"state":"2339.0"},{"time":1602391920000,"state":"2339.0"},{"time":160