[SOLVED] Openhab 2 and executeCommandLine / Exec

Same rule without spaces @@ replacement:

rule "Write NordPool energy prices to Influxdb"
		when 
			Item Renew_price changed
		then
			val results = executeCommandLine("curl -i -XPOST 'http://192.168.50.30:8086/write?db=openhab_db' --data-binary 'NP_Electricity_price_test value=919 1435362189575692180'",5000)
 			//val results = executeCommandLine("curl@@-i@@-XPOST@@'http://192.168.50.30:8086/write?db=openhab_db'@@--data-binary@@'NP_Electricity_price_test@@value=919@@1435362189575692186'", 1000)
            logInfo("NPpriceDB.rules",results)
end

gives timestamp error.
log:

2019-03-24 13:23:35.246 [INFO ] [arthome.model.script.NPpriceDB.rules] -   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100   162  100   105  100    57  17549   9526 --:--:-- --:--:-- --:--:-- 21000

HTTP/1.1 400 Bad Request

Content-Type: application/json

Request-Id: 43562332-4e27-11e9-8309-b827eb81a147

X-Influxdb-Build: OSS

X-Influxdb-Error: unable to parse '"NP_Electricity_price_test value=919 1435362189575692180"': bad timestamp

X-Influxdb-Version: 1.7.4

X-Request-Id: 43562332-4e27-11e9-8309-b827eb81a147

Date: Sun, 24 Mar 2019 11:23:35 GMT

Content-Length: 105

{"error":"unable to parse '\"NP_Electricity_price_test value=919 1435362189575692180\"': bad timestamp"}

also I see that quotation marks have switched from single quote to double quote.


this one worked:

rule "Write NordPool energy prices to Influxdb"
		when 
			Item Renew_price changed
		then
			val results = executeCommandLine("curl@@-i@@-XPOST@@http://192.168.50.30:8086/write?db=openhab_db@@--data-binary@@NP_Electricity_price_test value=919 1435362189575692180@@",5000)
 			//val results = executeCommandLine("curl@@-i@@-XPOST@@'http://192.168.50.30:8086/write?db=openhab_db'@@--data-binary@@'NP_Electricity_price_test@@value=919@@1435362189575692186'", 1000)
            logInfo("NPpriceDB.rules",results)
end

log:

2019-03-24 14:11:59.474 [INFO ] [arthome.model.script.NPpriceDB.rules] -   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100    55    0     0  100    55      0   3358 --:--:-- --:--:-- --:--:--  3666

HTTP/1.1 204 No Content

Content-Type: application/json

Request-Id: 06646066-4e2e-11e9-85d2-b827eb81a147

X-Influxdb-Build: OSS

X-Influxdb-Version: 1.7.4

X-Request-Id: 06646066-4e2e-11e9-85d2-b827eb81a147

Date: Sun, 24 Mar 2019 12:11:59 GMT

I removed all internal quote marks and I don’t understand how this could work as curl command needs those according to syntax. Totally illogical solution…