I try to get Test
item state from influxdb.
This script works ok, but maybe easier way exists?
curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d `curl -GET 'http://openhab:openhab@localhost:8086/query?db=openhab_db' --data-urlencode 'q=select last(ppm) from co2 where time > now() - 2h'` "http://localhost:8080/rest/items/Test/state"
Result:
[{"statement_id":0,"series":[{"name":"co2","columns":["time","last"],"values":[["2017-04-02T19:14:50.204Z",454]]}]}]}
It works from console, but not work from rules.
I try it with sudo -u openhab
- its ok.