SmartThings icon indicating copy to clipboard operation
SmartThings copied to clipboard

Add support for InfluxDB v2.x and Token authentication

Open Konnichy opened this issue 2 years ago • 10 comments

Hello,

I just switched to InfluxDB v2.3 and thought I'll provide you with the required modifications.

Konnichy avatar Aug 01 '22 21:08 Konnichy

While at it, I just realize I also made modifications years ago to support multi-byte characters.

Konnichy avatar Aug 01 '22 21:08 Konnichy

I have just tried these modifications, and they don't seem to work. Is the problem that the Organisation is not passed in the PostToInfluxDB? I get a 'not found' log response.

Ja50n-Kru avatar Oct 15 '22 15:10 Ja50n-Kru

Hello,

Are you sure you provided these 3 parameters in the SmartApp configuration?

  • bucket
  • organization
  • token

The Organization and Bucket are sent via URL, while only the Token is sent via header.

Konnichy avatar Oct 15 '22 15:10 Konnichy

Hi Konnichy - yes I have provided all parameters. I guess if you have this working, then it must be an error my end - I'll keep digging/playing! Thanks for your quick reply.

Ja50n-Kru avatar Oct 15 '22 15:10 Ja50n-Kru

I confirm it does work for me. All the required request info is passed to PostToInfluxDB() via the state variable.

Also, it's not visually obvious, but you can click on the first line in the SmartApp configuration panel to change the logging level. Setting it to "trace" could provide more information.

Konnichy avatar Oct 15 '22 16:10 Konnichy

Also, with Groovy being phased out, don't get your hopes too high. This SmartApp is expected to stop working before the end of the year in any case.

Konnichy avatar Oct 15 '22 16:10 Konnichy

With Groovy being phased out soon, does anyone know an alternative solution for data logging?

AllegrettoA avatar Oct 15 '22 20:10 AllegrettoA

Have a look here: https://github.com/eargollo/smartthings-influx This is the "InfluxDB topic" on SmartThings: https://community.smartthings.com/t/smartthings-data-visualisation-using-influxdb-and-grafana/44946/141.

I recently experimented with SmartApp development (and NodeJS, and Javascript) and I may try something on my side too. The downside of the app linked above is that it only polls. I'll use event subscriptions if I write it myself.

Konnichy avatar Oct 15 '22 21:10 Konnichy

@Konnichy, looking forward to your solution - it will likely be more simple and perform better than what I’ve seen so far. NodeJS type solutions seem too complex, require server setup, and as you stated only polls.

AllegrettoA avatar Oct 16 '22 13:10 AllegrettoA

Unfortunately, with SmartThings abandoning Groovy, they also stop running services on their cloud. Device drivers now run on the hub, but it is now left to us where SmartApps are hosted. They provide guidelines for hosting on Amazon AWS or our own servers. So it doesn't simplify the hosting process at all. Also, although the SmartThings API could be used from any development language, libraries provided by SmartThings are based on Node.js. So, any SmartApp development will likely be Node.js code.

Konnichy avatar Oct 17 '22 13:10 Konnichy