Hi All
I’m having difficulty getting OH3 to authorize itself with my instance of influxDB 2.0.7
Setup as follows:
influxDB
user: openhab
organization: warrimoo
bucket: warrimoo01
token is set up as All-Access
password is setup and working
OH3
influxDB persistence add-on is installed
/etc/openhab/services/influxdb.cfg
# The database URL, e.g. http://127.0.0.1:8086 or https://127.0.0.1:8084 .
# Defaults to: http://127.0.0.1:8086
url=http://192.168.1.33:8086
version=V2
# The name of the database user, e.g. openhab.
# Defaults to: openhab
user=openhab
# The password of the database user.
#password=**********
token=Kc-1Nh0lIw3VyRTGE6Tww2Wo8AeKSBbSDnGS-_Z9aHH_woOKlrIuHGOT7xFzr_vn9z8z4qDFhb2ikdiGbQbreA==
# The name of the database, e.g. openhab.
# Defaults to: openhab
db=warrimoo
retentionPolicy=warrimoo01
Note: I have left the token visible so that its structure can be seen particularly the use of dashes and equals signs. (The token has long since been deleted from my running system )
/etc/openhab/persistence/influxdb.persist
Strategies {
everyMinute : "0 * * * * ?"
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
}
Items {
Miflora_OneDot_Light, Color1000_Temperature : strategy = everyMinute
}
I don’t think the issue is in the .persist file as I get the following error message from the influxdb.service on the influxdb server
msg=Unauthorized log_id=0VNsKDiW000 error="authorization not found"
I have tested the org/bucket/token combination from the influxdb-cli on the influxdb server and I can write data to the bucket using the token with no problem.
I have also tested write access to the bucket using postman from another machine and this also works fine. I will note that the token passing is a little twitchy…
Here’s the url
http://192.168.1.33:8086/api/v2/write?bucket=warrimoo01&org=warrimoo&precision=s
It also needs a separate header added for the token. The word “Token” is essential and it must be capitalized.
Key: Authorization
Value: Token Kc-1Nh0lIw3VyRTGE6Tww2Wo8AeKSBbSDnGS-_Z9aHH_woOKlrIuHGOT7xFzr_vn9z8z4qDFhb2ikdiGbQbreA==
In my attempts to connect OH3 to the influxdb server I have tried all possible variations of the influxdb.cfg file
No inverted commas - no spaces between keys and values i.e.
key=value
No inverted commas - spaces between keys and values i.e.
key = value
Single inverted commas - no spaces between keys and values i.e.
key='value'
Single inverted commas - spaces between keys and values i.e.
key = 'value'
Double inverted commas - no spaces between keys and values i.e.
key="value"
Double inverted commas - spaces between keys and values i.e.
key = "value"
I have my suspicions that the correct configuration entry syntax is
No inverted commas - no spaces between keys and values
and that the existence of the “==” in the token is giving the config parser a problem.
I reason this way because
a) with single inverted commas around the token OH3 attempts to connect to influxdb and I get the authorization not found error
in combination with
b) without the inverted commas OH3 stops trying to access the influxdb server as if there was a config error
If anyone has any suggestions as to how this can be fixed I would be most grateful.
Perhaps there are escape sequences I can use?
Maybe the parser can be modified if that is the issue?
Many thanks in advance
Regards
Ian Carson