[APP][Pro] InfluxDb

InfluxDb support for Athom Homey

This app will log all numeric, boolean and enum capabilities to a InfluxDb database.

App store

Source

Install:

The IP address, port number and database for the InfluxDb must be entered in app settings.

For InfluxDB 2.x, the organization ID and token must be set. For InfluxDB 1.x they must not be set.

Release Notes:

1.1.0

  • Support for storing enum capabilities
  • Added ‘Write boolean’, ‘Write number’ and ‘Write text’ actions

1.0.0

  • Updated to SDK3
  • Updated settings

0.9.14

  • Can select between Homey and app metrics, or just Homey metrics

0.9.13

  • Added flows to enable/disable metrics and set write interval

0.9.12

  • Fixed escaping of non-breaking spaces

0.9.11

  • Added tag_2 for export of CPU usage

0.9.10

  • Added triggers for online and offline events
  • Added export of CPU usage per app
  • Name for measurements can be prefixed

0.9.9

  • Handle adding several devices at the same time
  • Updated Athom api.

0.9.8

  • Handle adding several devices at the same time

0.9.7

  • Name standard for measurements can be changed
  • Zone id and name as tags

0.9.6

  • Support for InfluxDB v2 and InfluxDb Cloud

0.9.5

  • Minor fixes on the settings page

0.9.3

  • Improved settings page

0.9.2

  • Added logging of Homey metrics
  • Added protocol, username and password to settings

0.9.1

  • Fixed timestamp for measurements

0.9.0

  • First version

Disclaimer:

Use at your own risk. I accept no responsibility for any damages caused by using this app.

8 Likes

v. 0.9.6 with support for InfluxDb v2 and InfluxDb cloud, is now ready for testing:

Please test :slight_smile:

2 Likes

To use the InfluxDb Cloud, go to https://www.influxdata.com/ to create an account. After you have logged in, you must create a token and a bucket

Then in settings for the app:

  • Hostname: go to “Data -> Client Libraries” to find the URL. So the hostname will be something like: eu-central-1-1.aws.cloud2.influxdata.com.
  • Protocol: select https.
  • Port number: 443
  • Organization ID: go to “Organization -> About”, to find the Organization ID.
  • Token: paste in the token you created.
  • Username: leave it blank.
  • Password: leave it blank.
  • Database/bucket: enter the name of the bucket you created.

It’s much easier to configure the app from the browser from this link, IMO:
https://developer.athom.com/tools/app-settings

3 Likes

Excellent work! A lot better than my hackish MQTT Hub -> Mosquitto -> Telegraf -> InfluxDB integration :wink:

I’ve got a few constructive notes I was hoping you could look into.
The naming structure seems a bit chaotic. Could I recommend this kind of structure instead:
SELECT mean(“measure_temperature”) FROM “Bedroom” WHERE (“name” = ‘Bedroom sensor’)
Right it’s like this:
SELECT mean(“measure_temperature”) FROM “Bedroom_sensor” WHERE (“name” = ‘Bedroom sensor’)
Which means the Bedroom_sensor name is used twice. Using the Zone as part of the data would make more structural sense. Let me know your thoughts on this.

Also, is it also possible to maybe have push interval part of the configuration? Or is it based on value change?

Other than that, great work and finally a way to collect metrics properly!

Thanks for the feedback !!

Right now it’s like this:

  • measurement: name of the device, but spaces are replaced with “_”… underscore
  • tag: id: the id of the device
  • tag: name: the name of the device. (",", “=” and " " escaped)
  • value

Changing this … would mean that all existing users would have to change their dashboards…

What about adding the zone as a tag ?

All changes are buffered before written to the IndexDb. The write interval to the IndexDb is 10 seconds.

The state of the Homey itself (cpu, memory, apps) is fetched every 30 seconds.

Thanks for this! Just installed Grafana and influxdb on my Qnap, really thinking of retiring MQTT!

1 Like

While I agree it’s a hassle that people using the app now would have to change their dashboards, I believe it would benefit a better structure in the long run.

This would be my suggestion:

measurement - Zone name (ie. Bedroom, Bathroom, Living room etc.)
tag - ID = UID
tag - Name = Device name
value - Capability (ie. measure_temperature, measure_current etc).

This way you would be able to create simpler queries.

Example:
I’ve got a lot of miflora plant sensors in the living room. Each of these report the value flora_measure_moisture. If I were to use the current setup, I would have to create one query per device. With the measurement being a zone, I could simply itterate through all name tags returned and create a graph for the moisture of all plants in one query.

A typical request for this type of query would be:
SELECT last(“flora_measure_moisture”) FROM “Living_room” WHERE $timeFilter GROUP BY “name”

Using ALIAS BY with $tag_flora_measure_moisture , I would be able to see graphing of the value for all devices in that zone.

I’m not saying you should change it if you don’t think it’s the correct way to do it. It’s always possible to work around this by creating one query per device, but with over a 100 devices in my house, and at least three values per device, we’re talking quite a lot of queries for a big dashboard.

P.S: I use grafana to poll the data from influxDB. I guess in other tools there might be other ways of doing polling which makes more sense in your configuration.

1 Like

Thanks for the feedback, again :slight_smile:

I have fixed this so you can select in settings the “name standard” for measurements: by name, by zone or by zone & name.

And this won’t ruin other users dashboards.

Install the version from test:

And, please test :slight_smile:

Works like a charm! This makes it quite a lot easier to collect metrics from mutliple devices in the same Zone :smiley: I just enabled the “By Zone” name standard. Thanks again for a great app, and for implementing the features.

1 Like


Wanted to test this. Folowed the steps but no seeing any measurments yet?
Can you help me out?

Check your port number. It must be 443 for access to the InfluxDb cloud servers.

Lol I am such an idiot :slight_smile: Thank you!

I use http://192.168.*.x:18086 for protocol and port number, but stays disconnected.

Trying http://192.168.*.x:18086/ping in a webbrowser, and fill in the same userid and password, I get the empty page (which i should). Using this same method I can do queries as well.

I installed influxdb v1 in a docker on my Nas, and grafana as well. Grafana is able to connect as well (docket to docket and via browser.

Made a database homey_6months and granted the user all privileges to this database.

Or could it be that this test Homey is running on version 5.

@M_a_r_c_o

Does the ping - request return status code 204 ?

Yes.

curl -v http://homey:******@192.168.10.2:18086/ping
‘’‘’

  • Trying 192.168.10.2…
  • TCP_NODELAY set
  • Connected to 192.168.10.2 (192.168.10.2) port 18086 (#0)
  • Server auth using Basic with user ‘homey’

GET /ping HTTP/1.1
Host: 192.168.10.2:18086
Authorization: Basic aG9tZXk***********xT0h2RHZS
User-Agent: curl/7.54.0
Accept: /

< HTTP/1.1 204 No Content
< Content-Type: application/json
< Request-Id: 21731d0b-d491-11ea-9184-0242ac110003
< X-Influxdb-Build: OSS
< X-Influxdb-Version: 1.8.1
< X-Request-Id: 21731d0b-d491-11ea-9184-0242ac110003
< Date: Sun, 02 Aug 2020 07:23:58 GMT
<

  • Connection #0 to host 192.168.10.2 left intact

I’ve tested on v. 1.8.1, on a 2.0.0 - release candidate and on Influxdata cloud. So this should work.

The ping - test has a 5000ms timeout, btw.

Can you press the “create diagnostics report” - button, and I will receive a log, and might see what’s wrong.

1 Like

Diag report: 2337ecfa-c553-4f46-b384-0e38ab9da5bf

In Insights, logic varables and betterlogic app numbers are shown, does your influxdb app support them?

Cant find them in Grafana at this moment.

Hi. This looks verry interesting, but I also get 0 measurements. Is it only new measurements it uploads? Does it take time before it uploads it to InfluxDb cloud? I’ve checked that Im using https and 443.

No, only number and boolean capabilities that you can find here https://developer.athom.com/tools/devices is supported.

And Homey CPU and memory usage, and app memory and storage usage.

But if we find a way to add logic variables and betterlogic app numbers, I will add that too.