iobroker.influxdb 3.1.8 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016-2022 bluefox <dogafox@gmail.com>, apollon77
3
+ Copyright (c) 2016-2024 bluefox <dogafox@gmail.com>, apollon77
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -18,36 +18,36 @@ This adapter saves state history into InfluxDB.
18
18
  ## InfluxDB version support
19
19
 
20
20
  ### InfluxDB 1.x
21
- If you have an InfluxDB 1.x installation (preferably 1.8.x or 1.9.x) then you choose " 1.x" in the adapter configuration and enter the Host-IP and Port together with Username and Password for the Access.
22
- You can also define a database name. The default is "iobroker". On first adapter start this database is created.
21
+ If you have an InfluxDB 1.x installation (preferably `1.8.x` or `1.9.x`) then you choose "1.x" in the adapter configuration and enter the Host-IP and Port together with Username and Password for the Access.
22
+ You can also define a database name. The default is `iobroker`. On the first adapter start, this database is created.
23
23
 
24
- When doing custom queries via the "query" message you can use InfluxQL to select the data you want. FluxQL with InfluxDB 1.x is not supported (and will also not be added).
24
+ When doing custom queries via the "query" message, you can use InfluxQL to select the data you want. FluxQL with InfluxDB 1.x is not supported (and will also not be added).
25
25
 
26
26
  ### InfluxDB 2.x
27
27
  Since 2.0 of the adapter also InfluxDB 2.x is supported which works a bit different.
28
28
  Here beside the Host-IP and Port the following data are required:
29
- * **Organization**: You need to create an organization on the commandline and need to enter the name or ID of that organization here. If you created one Organization when doing the InfluxDB setup you have created an initial organization and can use this here, else use `influx org list` to see available organizations.
30
- * **Authentication Token**: You need to create an Authentication token that have sufficient rights to basically do all actions on the provided organization! **Important: For now just use the initial owner auth token because we still struggle on how to create a token that has sufficient permissions. The Owner Token was generated on InfluxDB setup process. If you know how to create the right tokens let us now :-)**
29
+ * **Organization**: You need to create an organization on the commandline/WebUI and need to enter the name or ID of that organization here. If you created one Organization when doing the InfluxDB-setup, you have created an initial organization and can use this here, else use `influx org list` to see available organizations.
30
+ * **Authentication Token**: You must create an authentication token that has sufficient rights to allow the adapter to perform all necessary actions! To create a token with only minimal permissions for a single bucket, go to the WebUI and select: "API Tokens" --> "Generate API Token" --> "Custom API Token", select read/write permissions for the bucket and read permissions for "All Orgs" and "All Users". Alternatively you can generate an "All Access" token, which will grant all permissions for ALL buckets of given organization.
31
31
 
32
- You can also define a database name - this is used as Bucket. The default is "iobroker". On first adapter start this bucket is created in the configured organization.
32
+ You can also define a database name - this is used as a Bucket. The default is `iobroker`. On the first adapter start, this bucket is created in the configured organization.
33
33
 
34
- When doing custom queries via the "query" message you can use Flux queries to select the data you want. Details on Flux can be found at https://docs.influxdata.com/influxdb/v2.0/reference/flux/
34
+ When doing custom queries via the "query" message, you can use Flux queries to select the data you want. Details on Flux can be found at https://docs.influxdata.com/influxdb/v2.0/reference/flux/
35
35
 
36
36
  #### Store metadata information as tags instead of fields
37
- For Influx 1.x state value, as well as associated metadata fields (`q`, `ack` and `from`) are stored as fields within InfluxDB. When using Flux-commands to retrieve this data (instead of InfluxQL) the data is returned in separate tables, which makes it more difficult to view the data in a joined way when using external database clients or Influx CLI `query` command. This is by design, as Influx only supports one field per data-point.
37
+ For `Influx 1.x` state value, as well as associated metadata fields (`q`, `ack` and `from`) are stored as fields within InfluxDB. When using Flux-commands to retrieve this data (instead of `InfluxQL`) the data is returned in separate tables, which makes it more difficult to view the data in a joined way when using external database clients or Influx CLI `query` command. This is by design, as Influx only supports one field per data-point.
38
38
 
39
- With Influx 2.x it is now also possible, to store this metadata-information besides the actual value of the state as Influx Tags. Tags are indexed and allow for faster search queries. In addition, they are closely linked to the measurement stored within the db, meaning they will be returned in one table with the queried measurement which makes them much easier to handle, when used outside this adapter. There are limitations with this however:
39
+ With `Influx 2.x` it is now also possible, to store this metadata-information besides the actual value of the state as Influx Tags. Tags are indexed and allow for faster search queries. In addition, they are closely linked to the measurement stored within the db, meaning they will be returned in one table with the queried measurement which makes them much easier to handle, when used outside this adapter. There are limitations with this, however:
40
40
  - The use of tags for metadata needs to be enabled under `Advanced Settings`. It is disabled by default.
41
41
  - If you decide to use tags, you cannot continue to use old measurements that were gathered with Influx 1.x, as they are stored in fields.
42
42
  - Attempting to use an existing database that was set up without enabling the Tag-feature will cause the adapter to fail to initialize, and you will see an error message about it in the log.
43
43
  - This also is valid the other way: Once you start using the Tag-feature in a new database, you cannot switch back to using fields for this database.
44
- - This feature is currently only available, if you use Influx 2.x. And only if you use the new responsive GUI of Admin 5.
44
+ - This feature is currently only available if you use Influx 2.x. And only if you use the new responsive GUI of Admin 5.
45
45
 
46
46
  ### Migration from InfluxDB 1 to 2
47
47
 
48
48
  Please refer to the [official guides on how to migrate](https://docs.influxdata.com/influxdb/v2.0/upgrade/v1-to-v2/) from InfluxDB 1.x to 2.x. Especially the [migration instructions for time series data](https://docs.influxdata.com/influxdb/v2.0/upgrade/v1-to-v2/manual-upgrade/#migrate-time-series-data) have been verified to work during adapter testing. Please always create a backup of your data before performing the migration.
49
49
 
50
- After the migration, the adapter is able to work with the old data (e.g. for history-queries) as well. This only applies, if you don't decide to [use Tags for storing metadata fields](#Store-metadata-information-as-tags-instead-of-fields).
50
+ After the migration, the adapter is able to work with the old data (e.g. for history-queries) as well. This only applies if you don't decide to [use Tags for storing metadata fields](#Store-metadata-information-as-tags-instead-of-fields).
51
51
 
52
52
  ## Retention Policy
53
53
  While Influx 1.x supports the concept of multiple **retention policies** for one database, Influx 2 by design allows only one **retention period** per bucket. Therefore, it is only possible to set one policy for the whole database/bucket with this adapter via _Default Settings -> Storage retention_. The retention selected here will be applied on the fly and can be changed at any time. Retention policies set by the adapter will never be deleted, but instead altered if required, as otherwise Influx 1.x would delete all data that the policy applied to.
@@ -55,32 +55,32 @@ While Influx 1.x supports the concept of multiple **retention policies** for one
55
55
  Please also read [Understanding Retention Policies](RetentionPolicies.md).
56
56
 
57
57
  ## Direct writes or buffered writes?
58
- With the default configuration the adapter stores each single datapoint directly into the database and only use the internal buffer if the database is not available. If the database was not available the buffer is flushed at the given interval, so it can take the defined interval till the missing points are written!
58
+ With the default configuration, the adapter stores each single datapoint directly into the database and only uses the internal buffer if the database is not available. If the database was not available, the buffer is flushed at the given interval, so it can take the defined interval till the missing points are written!
59
59
 
60
- By changing the configuration it is possible to cache new data points up to a defined count or a defined maximum interval after which all points are stored into the database. This also gives better performance and less system load compared to writing the data points directly.
60
+ By changing the configuration, it is possible to cache new data points up to a defined count or a defined maximum interval after which all points are stored into the database. This also gives better performance and less system load compared to writing the data points directly.
61
61
  InfluxDB has a limitation of the maximum size for writes which is at around 2MB. It should be safe to have up to 15.000 data points as buffer maximum, maybe also 20.000, but this highly depends on the length of your datapoint-IDs.
62
62
 
63
- On exit of the adapter the buffer is stored on disk and reinitialized with next adapter start, so no data points should be lost and will be written after next start.
63
+ On exit of the adapter the buffer is stored on disk and reinitialized with the next adapter start, so no data points should be lost and will be written after the next start.
64
64
 
65
65
  ## InfluxDB and data types
66
- InfluxDB is very strict on data types. The datatype for a measurement value is defined with it's first write.
67
- The adapter tries to write with the correct value, but if the datatype changes for the same state then there may be the write
68
- errors in the InfluxDB. The adapter detects this and will write these potential conflicting data points always directly, but write errors mean that the value is not written into the DB at all. So make sure to check the logs for such cases.
66
+ InfluxDB is very strict on data types. The datatype for a measurement value is defined with its first write.
67
+ The adapter tries to write with the correct value, but if the datatype changes for the same state, then there may be the write errors in the InfluxDB.
68
+ The adapter detects this and will write these potential conflicting data points always directly, but write errors mean that the value is not written into the DB at all. So make sure to check the logs for such cases.
69
69
 
70
- **In Version 1.x and 2.x of the adapter it could also be that some values were converted wrong when no datatype was defined. E.g. a String like "37.5;foo bar" was converted to a number 37.5 in older versions. The version 3 odf the adapter will detect that this is not a valid number and will not convert this value. This could lead to type conflicts after the update. Please check these values and think if you need to store it and how (for the future).**
70
+ **In Version 1.x and 2.x of the adapter, it could also be that some values were converted wrong when no datatype was defined. E.g. a String like `37.5;foo bar` was converted to a number 37.5 in older versions. The version 3 odf the adapter will detect that this is not a valid number and will not convert this value. This could lead to type conflicts after the update. Please check these values and think if you need to store it and how (for the future).**
71
71
 
72
- Additionally, InfluxDB do not support "null" values, so these are not written at all into the DB.
72
+ Additionally, InfluxDB does not support "null" values, so these are not written at all into the DB.
73
73
 
74
74
  ## Installation of InfluxDB
75
75
  Please refer to the official InfluxDB pages for installation instructions depending on your OS.
76
76
 
77
77
  * InfluxDB 1.x: https://docs.influxdata.com/influxdb/v1.8/introduction/install/
78
- * InfluxDB 2.x: https://docs.influxdata.com/influxdb/v2.0/install/
78
+ * InfluxDB 2.x: https://docs.influxdata.com/influxdb/v2.2/install/
79
79
 
80
80
  ### Setup authentication for InfluxDB 1.x (optional)
81
81
  **NOTE:** Influx DB V2.x relies on organization/token login, instead of username/password! This is only applicable for InfluxDB 1.x
82
82
 
83
- If you use DB locally you may leave authentication disabled and skip this part.
83
+ If you use DB locally, you may leave authentication disabled and skip this part.
84
84
 
85
85
  - Start service: ``` service influxdb start ```
86
86
  - Go to admin page: http://<ip>:8083
@@ -91,7 +91,7 @@ CREATE USER "user" WITH PASSWORD '<userpassword>'
91
91
  CREATE DATABASE "iobroker"
92
92
  GRANT ALL ON "iobroker" TO "user"
93
93
  ```
94
- Enable authentication, by editing /etc/influxdb/influxdb.conf:
94
+ Enable authentication by editing /etc/influxdb/influxdb.conf:
95
95
  ```
96
96
  [http]
97
97
  enabled = true
@@ -106,27 +106,27 @@ Enable authentication, by editing /etc/influxdb/influxdb.conf:
106
106
  - Restart service: ``` service influxdb restart ```
107
107
 
108
108
  ## Installation of Grafana (Charting Tool)
109
- There is additional charting tool for InfluxDB - Grafana.
109
+ There is an additional charting tool for InfluxDB - Grafana.
110
110
  It must be installed additionally.
111
111
 
112
112
  Install a current version of Grafana 3.x+ because InfluxDB support is enhanced there in comparison to earlier Grafana versions.
113
113
 
114
114
  Under debian you can install it as described at http://docs.grafana.org/installation/debian/ .
115
- For ARM platforms your can check vor v3.x at https://github.com/fg2it/grafana-on-raspberry.
115
+ For ARM platforms you can check vor v3.x at https://github.com/fg2it/grafana-on-raspberry.
116
116
 
117
117
  Explanation for other OS can be found [here](http://docs.grafana.org/installation/).
118
118
 
119
- After the Grafana is installed, follow [this](http://docs.grafana.org/datasources/influxdb/) to create connection.
119
+ After the Grafana is installed, follow [this](http://docs.grafana.org/datasources/influxdb/) to create a connection.
120
120
 
121
121
  ## Default Settings
122
122
  - **Debounce Time** - Protection against unstable values to make sure that only stable values are logged when the value did not change in the defined amount of Milliseconds. ATTENTION: If values change more often then this setting effectively no value will be logged (because any value is unstable)
123
123
  - **Blocktime** - Defines for how long after storing the last value no further value is stored. When the given time in Milliseconds is over then the next value that fulfills all other checks is logged.
124
- - **Record changes only** - This function make sure that only changed values are logged if they fulfill other checks (see below). Same values will not be logged.
124
+ - **Record changes only** - This function makes sure that only changed values are logged if they fulfill other checks (see below). Same values will not be logged.
125
125
  - **still record the same values (seconds)** - When using "Record changes only" you can set a time interval in seconds here after which also unchanged values will be re-logged into the DB. You can detect the values re-logged by the adapter with the "from" field.
126
126
  - **Minimum difference from last value** - When using "Record changes only" you can define the required minimum difference between the new value and the last value. If this is not reached the value is not recorded.
127
127
  - **ignore 0 or null values (==0)** - You can define if 0 or null values should be ignored.
128
128
  - **ignore values below zero (<0)** - You can define if values below zero should be ignored.
129
- - **Disable charting optimized logging of skipped values** - By default the adapter tries to record the values for optimized charting. This can mean that additional values (that e.g. not fulfilled all checks above) are logged automatically. If this is not wanted, you can disable this feature.
129
+ - **Disable charting optimized logging of skipped values** - By default, the adapter tries to record the values for optimized charting. This can mean that additional values (that e.g. not fulfilled all checks above) are logged automatically. If this is not wanted, you can disable this feature.
130
130
  - **Alias-ID** - You can define an alias for the ID. This is useful if you have changed a device and want to have continuous data logging. Please consider switching to real alias States in teh future!
131
131
  - **Storage retention** - How many values in the past will be stored on disk. Data are deleted when the time is reached as soon as new data should be stored for a datapoint.
132
132
  - **Enable enhanced debug logs for the datapoint** - If you want to see more detailed logs for this datapoint, you can enable this option. You still need to enable "debug" loglevel for these additional values to be visible! This helps in debugging issues or understanding why the adapter is logging a value (or not).
@@ -172,8 +172,8 @@ sendTo('influxdb.0', 'getHistory', {
172
172
  ```
173
173
 
174
174
  Possible options:
175
- - **start** - (optional) time in ms - *Date.now()*'
176
- - **end** - (optional) time in ms - *Date.now()*', by default is (now + 5000 seconds)
175
+ - **start** - (optional) time in ms - `Date.now()`
176
+ - **end** - (optional) time in ms - `Date.now()`. The default value is `now + 5000 seconds`
177
177
  - **step** - (optional) used in aggregate (max, min, average, total, ...) step in ms of intervals
178
178
  - **count** - number of values if aggregate is 'onchange' or number of intervals if other aggregate method. Count will be ignored if step is set, else default is 500 if not set
179
179
  - **from** - if *from* field should be included in answer
@@ -183,7 +183,7 @@ Possible options:
183
183
  - **limit** - do not return more entries than limit
184
184
  - **round** - round result to number of digits after decimal point
185
185
  - **ignoreNull** - if null values should be included (false), replaced by last not null value (true) or replaced with 0 (0)
186
- - **removeBorderValues** - By default additional border values are returned to optimize charting. Set this option to true if this is not wanted (e.g. for script data processing)
186
+ - **removeBorderValues** - By default, additional border values are returned to optimize charting. Set this option to true if this is not wanted (e.g. for script data processing)
187
187
  - **returnNewestEntries** - The returned data are always sorted by timestamp ascending. When using aggregate "none" and also providing "count" or "limit" this means that normally the oldest entries are returned (unless no start data is provided). Set this option to true to get the newest entries instead.
188
188
  - **aggregate** - aggregate method (Default: 'average'):
189
189
  - *minmax* - used special algorithm. Splice the whole time range in small intervals and find for every interval max, min, start and end values.
@@ -192,30 +192,30 @@ Possible options:
192
192
  - *average* - Same as max, but take average value.
193
193
  - *total* - Same as max, but calculate total value.
194
194
  - *count* - Same as max, but calculate number of values (nulls will be calculated).
195
- - *percentile* - Calculate n-th percentile (n is given in options.percentile or defaults to 50 if not provided).
195
+ - *percentile* - Calculate n-th percentile (n is given in `options.percentile` or defaults to 50 if not provided).
196
196
  - *quantile* - Calculate n quantile (n is given in options.quantile or defaults to 0.5 if not provided).
197
197
  - *integral* - Calculate integral (additional parameters see below).
198
- - *none* - No aggregation at all. Only raw values in given period.
198
+ - *none* - No aggregation at all. Only raw values in the given period.
199
199
  - **percentile** - (optional) when using aggregate method "percentile" defines the percentile level (0..100)(defaults to 50)
200
200
  - **quantile** - (optional) when using aggregate method "quantile" defines the quantile level (0..1)(defaults to 0.5)
201
- - **integralUnit** - (optional) when using aggregate method "integral" defines the unit in seconds (defaults to 60s). e.g. to get integral in hours for Wh or such, set to 3600.
201
+ - **integralUnit** - (optional) when using aggregate method "integral" defines the unit in seconds (default to 60s). e.g. to get integral in hours for Wh or such, set to 3600.
202
202
  - **integralInterpolation** - (optional) when using aggregate method "integral" defines the interpolation method (defaults to "none").
203
203
  - *linear* - linear interpolation
204
204
  - *none* - no/stepwise interpolation
205
205
 
206
- The first and last points will be calculated for aggregations, except aggregation "none".
207
- If you manually request some aggregation you should ignore first and last values, because they are calculated from values outside of period.
206
+ The first and last points will be calculated for aggregations, except aggregation `none`.
207
+ If you manually request some aggregation, you should ignore first and last values, because they are calculated from values outside of the period.
208
208
 
209
- When raw data are selected without using 'step' the returned fields are ts, val, ack, q and from.
210
- As soon as step is used the returned fields are ts and val.
209
+ When raw data are selected without using `step`, the returned fields are `ts`, `val`, `ack`, `q` and `from`.
210
+ As soon as a step is used, the returned fields are ts and val.
211
211
 
212
212
  Interpolated values will be marked as `i=true`, like: `{i: true, val: 4.7384845, ts: 29892365723652}`.
213
213
 
214
214
  Please hold in mind that InfluxDB aggregates on "rounded time boundaries" (see https://docs.influxdata.com/influxdb/v0.11/troubleshooting/frequently_encountered_issues/#understanding-the-time-intervals-returned-from-group-by-time-queries)
215
215
 
216
216
  InfluxDB is very strict when it comes to data types. This has effects for aggregator functions, e.g.:
217
- * average (MEAN) can not be used for boolean values (true/false), only MIN or MAX works here
218
- * average (MEAN) can not be used for string values (text), no aggregator makes sense here at all
217
+ * average (MEAN) cannot be used for boolean values (true/false), only MIN or MAX works here
218
+ * average (MEAN) cannot be used for string values (text), no aggregator makes sense here at all
219
219
  * ...
220
220
 
221
221
  ## Custom queries
@@ -228,7 +228,7 @@ That's why the result is always an array with one numbered index for each query.
228
228
  ### Influx 1.x
229
229
  Example with one query:
230
230
 
231
- ```
231
+ ```javascript
232
232
  sendTo('influxdb.0', 'query', 'SELECT * FROM iobroker.global."system.adapter.admin.0.memRss" LIMIT 100', function (result) {
233
233
  if (result.error) {
234
234
  console.error(result.error);
@@ -240,7 +240,7 @@ sendTo('influxdb.0', 'query', 'SELECT * FROM iobroker.global."system.adapter.adm
240
240
  ```
241
241
  Two queries:
242
242
 
243
- ```
243
+ ```javascript
244
244
  sendTo('influxdb.0', 'query', 'SELECT * FROM iobroker.global."system.adapter.admin.0.memRss" LIMIT 100; SELECT * FROM iobroker.global."system.adapter.admin.0.memHeapUsed" LIMIT 100', function (result) {
245
245
  if (result.error) {
246
246
  console.error(result.error);
@@ -254,11 +254,11 @@ sendTo('influxdb.0', 'query', 'SELECT * FROM iobroker.global."system.adapter.adm
254
254
  **NOTE:** The values are coming back in the result array in filename "value" (instead of "val" as normal in ioBroker)
255
255
 
256
256
  ### Influx 2.x
257
- In InfluxDB v2.0 onwards the SQL-based query language *InfluxQL* is deprecated in favour of *Flux*. For more information please refer to [the offical InfluxDB 2.0 documentation](https://docs.influxdata.com/influxdb/v2.0/reference/flux/).
257
+ In InfluxDB v2.0 onwards, the SQL-based query language *InfluxQL* is deprecated in favour of *Flux*. For more information, please refer to [the offical InfluxDB 2.0 documentation](https://docs.influxdata.com/influxdb/v2.0/reference/flux/).
258
258
 
259
259
  Example with one query:
260
260
 
261
- ```
261
+ ```javascript
262
262
  sendTo('influxdb.0', 'query', 'from(bucket: "iobroker") |> range(start: -3h)', function (result) {
263
263
  if (result.error) {
264
264
  console.error(result.error);
@@ -269,44 +269,43 @@ sendTo('influxdb.0', 'query', 'from(bucket: "iobroker") |> range(start: -3h)', f
269
269
  });
270
270
  ```
271
271
  Two queries:
272
- **NOTE:** By default you cannot execute 2 queries at once via Flux-language, as there is no delimiter available. This adapter emulates this behaviour by defining ; as delimiter, so you can still run two queries in one statement.
272
+ **NOTE:** By default, you cannot execute 2 queries at once via Flux-language, as there is no delimiter available. This adapter emulates this behaviour by defining `;` as delimiter, so you can still run two queries in one statement.
273
273
 
274
- ```
274
+ ```javascript
275
275
  sendTo('influxdb.0', 'query', 'from(bucket: "iobroker") |> range(start: -3h); from(bucket: "iobroker") |> range(start: -1h)" LIMIT 100', function (result) {
276
276
  if (result.error) {
277
277
  console.error(result.error);
278
278
  } else {
279
279
  // show result
280
- console.log('Rows First: ' + JSON.stringify(result.result[0])); //Values from last 3 hours
281
- console.log('Rows Second: ' + JSON.stringify(result.result[1])); //Values from last hour
280
+ console.log('Rows First: ' + JSON.stringify(result.result[0])); // Values from last 3 hours
281
+ console.log('Rows Second: ' + JSON.stringify(result.result[1])); // Values from last hour
282
282
  }
283
283
  });
284
284
  ```
285
285
  **NOTE:** The values are coming back in the result array in filename "value" (instead of "val" as normal in ioBroker)
286
286
 
287
-
288
287
  ## storeState
289
- If you want to write other data into the InfluxDB you can use the build in system function **storeState**.
288
+ If you want to write other data into the InfluxDB, you can use the build in system function **storeState**.
290
289
  This function can also be used to convert data from other History adapters like History or SQL.
291
290
 
292
- A successful response do not mean that the data are really written out to the disk. It just means that they were processed.
291
+ A successful response does not mean that the data is really written out to the disk. It just means that they were processed.
293
292
 
294
- The given ids are not checked against the ioBroker database and do not need to be set up or enabled there. If own IDs are used without settings then the "rules" parameter is not supported and will result in an error. The default "Maximal number of stored in RAM values" is used for such IDs.
293
+ The given ids are not checked against the ioBroker database and do not need to be set up or enabled there. If own IDs are used without settings, then the "rules" parameter is not supported and will result in an error. The default "Maximal number of stored in RAM values" is used for such IDs.
295
294
 
296
295
  The Message can have one of the following three formats:
297
296
  * one ID and one state object
298
297
 
299
- ```
300
- sendTo('history.0', 'storeState', [
298
+ ```javascript
299
+ sendTo('influxdb.0', 'storeState', {
301
300
  id: 'mbus.0.counter.xxx',
302
301
  state: {ts: 1589458809352, val: 123, ack: false, from: 'system.adapter.whatever.0', ...}
303
- ], result => console.log('added'));
302
+ }, result => console.log('added'));
304
303
  ```
305
304
 
306
305
  * one ID and array of state objects
307
306
 
308
- ```
309
- sendTo('history.0', 'storeState', {
307
+ ```javascript
308
+ sendTo('influxdb.0', 'storeState', {
310
309
  id: 'mbus.0.counter.xxx',
311
310
  state: [
312
311
  {ts: 1589458809352, val: 123, ack: false, from: 'system.adapter.whatever.0', ...},
@@ -317,21 +316,21 @@ sendTo('history.0', 'storeState', {
317
316
 
318
317
  * array of multiple IDs with one state object each
319
318
 
320
- ```
321
- sendTo('history.0', 'storeState', [
319
+ ```javascript
320
+ sendTo('influxdb.0', 'storeState', [
322
321
  {id: 'mbus.0.counter.xxx', state: {ts: 1589458809352, val: 123, ack: false, from: 'system.adapter.whatever.0', ...}},
323
322
  {id: 'mbus.0.counter.yyy', state: {ts: 1589458809353, val: 123, ack: false, from: 'system.adapter.whatever.0', ...}}
324
323
  ], result => console.log('added'));
325
324
  ```
326
325
 
327
- Additionally, you can add attribute `rules: true` in message to activate all rules, like `counter`, `changesOnly`, `de-bounce` and so on
326
+ Additionally, you can add attribute `rules: true` in a message to activate all rules, like `counter`, `changesOnly`, `de-bounce` and so on
328
327
 
329
- In case of errors an array with all single error messages is returned and also a successCount to see how many entries were stored successfully.
328
+ In case of errors, an array with all single error messages is returned and also a successCount to see how many entries were stored successfully.
330
329
 
331
330
  ## delete state
332
- If you want to delete entry from the Database you can use the build in system function **delete**:
331
+ If you want to delete entry from the Database, you can use the build in system function `delete`:
333
332
 
334
- ```
333
+ ```javascript
335
334
  sendTo('influxdb.0', 'delete', [
336
335
  {id: 'mbus.0.counter.xxx', state: {ts: 1589458809352}},
337
336
  {id: 'mbus.0.counter.yyy', state: {ts: 1589458809353}}
@@ -340,7 +339,7 @@ sendTo('influxdb.0', 'delete', [
340
339
 
341
340
  To delete ALL history data for some data point execute:
342
341
 
343
- ```
342
+ ```javascript
344
343
  sendTo('influxdb.0', 'deleteAll', [
345
344
  {id: 'mbus.0.counter.xxx'},
346
345
  {id: 'mbus.0.counter.yyy'}
@@ -349,7 +348,7 @@ sendTo('influxdb.0', 'deleteAll', [
349
348
 
350
349
  To delete history data for some data point and for some range, execute:
351
350
 
352
- ```
351
+ ```javascript
353
352
  sendTo('influxdb.0', 'deleteRange', [
354
353
  {id: 'mbus.0.counter.xxx', start: '2019-01-01T00:00:00.000Z', end: '2019-12-31T23:59:59.999'},
355
354
  {id: 'mbus.0.counter.yyy', start: 1589458809352, end: 1589458809353}
@@ -361,21 +360,21 @@ Time could be ms since epoch or ans string, that could be converted by javascrip
361
360
  Values will be deleted including defined limits. `ts >= start AND ts <= end`
362
361
 
363
362
  ## change state
364
- If you want to change entry's value, quality or acknowledge flag in the database you can use the build in system function **update**:
363
+ If you want to change entry's value, quality or acknowledge flag in the database, you can use the build in system function `update`:
365
364
 
366
- ```
365
+ ```javascript
367
366
  sendTo('influxdb.0', 'update', [
368
367
  {id: 'mbus.0.counter.xxx', state: {ts: 1589458809352, val: 15, ack: true, q: 0}},
369
368
  {id: 'mbus.0.counter.yyy', state: {ts: 1589458809353, val: 16, ack: true, q: 0}}
370
369
  ], result => console.log('deleted'));
371
370
  ```
372
371
 
373
- `ts` is mandatory. At least one other flags must be included in state object.
372
+ `ts` is mandatory. At least one other flag must be included in a state object.
374
373
 
375
374
  ## Flush Buffers
376
- If you want to flush the buffers for one or all datapoints to the Database you can use the build in system function **flushBuffer**:
375
+ If you want to flush the buffers for one or all data points to the Database, you can use the build in system function `flushBuffer`:
377
376
 
378
- ```
377
+ ```javascript
379
378
  sendTo('influxdb.0', 'flushBuffer', {id: 'mbus.0.counter.xxx'
380
379
  , result => console.log('deleted, error: ' + result.error));
381
380
  ```
@@ -385,9 +384,9 @@ if no id is provided all buffers will be flushed.
385
384
  The adapter supports enabling and disabling of history logging via JavaScript and also retrieving the list of enabled data points with their settings.
386
385
 
387
386
  ### enable
388
- The message requires to have the "id" of the datapoint. Additionally, optional "options" to define the datapoint specific settings:
387
+ The message requires having the `id` of the datapoint. Additionally, optional `options` to define the datapoint specific settings:
389
388
 
390
- ```
389
+ ```javascript
391
390
  sendTo('influxdb.0', 'enableHistory', {
392
391
  id: 'system.adapter.influxdb.0.memRss',
393
392
  options: {
@@ -409,9 +408,9 @@ sendTo('influxdb.0', 'enableHistory', {
409
408
  ```
410
409
 
411
410
  ### disable
412
- The message requires to have the "id" of the datapoint.
411
+ The message requires having the `id` of the datapoint.
413
412
 
414
- ```
413
+ ```javascript
415
414
  sendTo('influxdb.0', 'disableHistory', {
416
415
  id: 'system.adapter.influxdb.0.memRss',
417
416
  }, function (result) {
@@ -427,19 +426,19 @@ sendTo('influxdb.0', 'disableHistory', {
427
426
  ### get List
428
427
  The message has no parameters.
429
428
 
430
- ```
429
+ ```javascript
431
430
  sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
432
431
  //result is object like:
433
432
  {
434
- "system.adapter.influxdb.0.memRss": {
435
- "changesOnly":true,
436
- "debounce":0,
437
- "retention":31536000,
438
- "maxLength":3,
439
- "changesMinDelta":0.5,
440
- "enabled":true,
441
- "changesRelogInterval":0,
442
- "aliasId":""
433
+ 'system.adapter.influxdb.0.memRss': {
434
+ changesOnly: true,
435
+ debounce: 0,
436
+ retention: 31536000,
437
+ maxLength: 3,
438
+ changesMinDelta: 0.5,
439
+ enabled: true,
440
+ changesRelogInterval: 0,
441
+ aliasId: ''
443
442
  }
444
443
  ...
445
444
  }
@@ -452,21 +451,32 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
452
451
  -->
453
452
 
454
453
  ## Changelog
454
+ ### 4.0.2 (2024-01-03)
455
+ * (bluefox) Corrected JSON config
456
+ * (Marc-Berg) Corrected filter function in booleanTypeCheckQuery
457
+ * (Marc-Berg) Allowed the self-signed certificates using "test connection" button
458
+ * (Marc-Berg) The deletion of data from DB was implemented for V2
459
+ * (bluefox) Added support for `count` aggregate type on getHistory
460
+ * (bluefox) minimal supported node.js version is 16 now
461
+
462
+ ### 3.2.0 (2022-09-19)
463
+ * (Apollon77) Adjust cache file to be different per instance when having multiple instances
464
+
455
465
  ### 3.1.8 (2022-08-13)
456
466
  * (Apollon77) Fix crash cases reported by Sentry
457
467
 
458
468
  ### 3.1.7 (2022-06-27)
459
- * (Apollon77) Allow to remove a configuration value for "round" in config again
469
+ * (Apollon77) Allows removing a configuration value for "round" in config again
460
470
 
461
471
  ### 3.1.6 (2022-06-27)
462
472
  * (Apollon77) When not count is provided for aggregate "none" or "onchange" then the limit (default 2000) is used as count to define the number of data to return.
463
473
 
464
474
  ### 3.1.5 (2022-06-12)
465
- * (Apollon77) Make sure debug log is active according to the settings
475
+ * (Apollon77) Make sure the debug log is active, according to the settings
466
476
 
467
477
  ### 3.1.4 (2022-06-08)
468
478
  * (Apollon77) Performance optimizations for GetHistory calls, especially for "minmax" aggregate method
469
- * (Apollon77) Prevent crash case reported by Sentry
479
+ * (Apollon77) Prevent the crash case reported by Sentry
470
480
 
471
481
  ### 3.1.3 (2022-06-01)
472
482
  * (Apollon77) Corrected issue when testing connection to InfluxDBv1 with weird passwords
@@ -475,7 +485,7 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
475
485
  * (Apollon77) Workaround an admin issue when testing connection to InfluxDB
476
486
 
477
487
  ### 3.1.0 (2022-05-27)
478
- * (Apollon77) Data are not converted to number if they are other data types on getHistory to respect the saved data formats as defined in the datapoint settings for storage.
488
+ * (Apollon77) Data are not converted to number if they are other data types on `getHistory` to respect the saved data formats as defined in the datapoint settings for storage.
479
489
  * (Apollon77) Fix retention change to lower checkbox in UI
480
490
  * (Apollon77) Allow storeState again to write to InfluxDB for "unknown state ids" - "rules" usage is not supported in for this and storeState would be silently discarded in this case!
481
491
  * (Apollon77) Fix several crash cases reported by Sentry
@@ -483,7 +493,7 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
483
493
  * (Apollon77) Allow storeState and GetHistory also to be called for "unknown ids"
484
494
 
485
495
  ### 3.0.2 (2022-05-12)
486
- * (Apollon77) handle an empty Path for InfluxDB 2.0 correctly in all cases
496
+ * (Apollon77) handles an empty Path for InfluxDB 2.0 correctly in all cases
487
497
 
488
498
  ### 3.0.1 (2022-05-11)
489
499
  * (Apollon77) BREAKING: Configuration is only working in the new Admin 5 UI!
@@ -494,20 +504,20 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
494
504
  * (Apollon77) Breaking! Did bigger adjustments to the recording logic. Debounce is refined and blockTime is added to differentiate between the two checks
495
505
  * (Apollon77) Breaking! GetHistory requests now need to deliver the ts in milliseconds! Make sure to use up to date scripts and Charting UIs
496
506
  * (Apollon77) New setting added to disable the "logging of additional values for charting optimization" - then only the expected data are logged
497
- * (Apollon77) Add new Debug flag to enable/disable debug logging on datapoint level (default is false) to optimize performance
498
- * (Apollon77) Add flag returnNewestEntries for GetHistory to determine which records to return when more entries as "count" are existing for aggregate "none"
507
+ * (Apollon77) Added new Debug flag to enable/disable debug logging on datapoint level (default is false) to optimize performance
508
+ * (Apollon77) Added flag returnNewestEntries for GetHistory to determine which records to return when more entries as "count" are existing for aggregate "none"
499
509
  * (Apollon77) Flush the buffer for the datapoint which is queried by GetHistory before the query is done, so that all data are in the database
500
510
  * (Apollon77) make sure id is always returned on GetHistory when addId is set
501
- * (Apollon77) Add aggregate method "percentile" to calculate the percentile (0..100) of the values (requires options.percentile with the percentile level, defaults to 50 if not provided). Basically same as Quantile just different levels are used. Calculation will be done by InfluxDB
502
- * (Apollon77) Add aggregate method "quantile" to calculate the quantile (0..1) of the values (requires options.quantile with the quantile level, defaults to 0.5 if not provided). Basically same as Percentile just different levels are used. Calculation will be done by InfluxDB
503
- * (Apollon77) Add (experimental) method "integral" to calculate the integral of the values. Requires options.integralUnit with the time duration of the integral in seconds, defaults to 60s if not provided. Optionally a linear interpolation can be done by setting options.integralInterpolation to "linear". Calculation will be done byInfluxDB (except for InfluxDB 1 and interpolation "linear", this is done by adapter on raw data)
511
+ * (Apollon77) Added aggregate method "percentile" to calculate the percentile (0..100) of the values (requires options.percentile with the percentile level, defaults to 50 if not provided). Basically same as Quantile just different levels are used. Calculation will be done by InfluxDB
512
+ * (Apollon77) Added aggregate method "quantile" to calculate the quantile (0..1) of the values (requires options.quantile with the quantile level, defaults to 0.5 if not provided). Basically same as Percentile just different levels are used. Calculation will be done by InfluxDB
513
+ * (Apollon77) Added (experimental) method "integral" to calculate the integral of the values. Requires options.integralUnit with the time duration of the integral in seconds, defaults to 60s if not provided. Optionally a linear interpolation can be done by setting options.integralInterpolation to "linear". Calculation will be done byInfluxDB (except for InfluxDB 1 and interpolation "linear", this is done by adapter on raw data)
504
514
  * (Apollon77) When request contains flag removeBorderValues: true, the result then cut the additional pre and post border values out of the results
505
515
  * (Apollon77) Enhance the former "Ignore below 0" feature and now allow specifying to ignore below or above specified values. The old setting is converted to the new one
506
516
  * (Apollon77) Allow to specify custom retention duration in days
507
- * (Apollon77) Add a new message flushBuffer to flush complete buffers or for a given id
517
+ * (Apollon77) Added a new message flushBuffer to flush complete buffers or for a given id
508
518
  * (Apollon77) Allow to specify an additional path for the InfluxDB URL, when Reverse proxies are used or such
509
519
  * (Apollon77) Make sure that min change delta allows numbers entered with comma (german notation) in all cases
510
- * (Apollon77) Add support to specify how to round numbers on query per datapoint
520
+ * (Apollon77) Added support to specify how to round numbers on query per datapoint
511
521
  * (Apollon77) Allow to specify if the last value of a state is logged on startup
512
522
 
513
523
  ### 2.6.3 (2022-03-07)
@@ -515,7 +525,7 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
515
525
 
516
526
  ### 2.6.2 (2022-03-03)
517
527
  * (Apollon77) Correctly handle db names with hyphens for InfluxDB 1
518
- * (Apollon77) Fix getHistory for non boolean fields
528
+ * (Apollon77) Fix getHistory for non-boolean fields
519
529
  * (Apollon77) Adjust shard group duration to influxdb proposals
520
530
 
521
531
  ### 2.6.1 (2022-02-28)
@@ -523,7 +533,7 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
523
533
 
524
534
  ### 2.6.0 (2022-02-24)
525
535
  * (Excodibur) Make request timeout configurable - defaults to 30s
526
- * (Apollon77) Add option to also accept self signed ssl certificates for InfluxDB 2.x
536
+ * (Apollon77) Added an option to also accept self-signed ssl certificates for InfluxDB 2.x
527
537
 
528
538
  ### 2.5.2 (2022-02-22)
529
539
  * (bluefox) Marked interpolated data with `i=true`
@@ -536,7 +546,7 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
536
546
  * (Excodibur) Added expert settings to deactivate health checks for Influx 2 db (There are no health checks for Influx 1)
537
547
  * (Excodibur) Hide settings not relevant when "log changes only" is not used
538
548
  * (Apollon77) Allow all number values for debounce again
539
- * (Apollon77) InfluxDB also do not like Infinite values, so ignore them too
549
+ * (Apollon77) InfluxDB also does not like Infinite values, so ignore them too
540
550
 
541
551
  ### 2.3.0 (2021-12-14)
542
552
  * (bluefox) Support only `js.controller` >= 3.3.x
@@ -544,7 +554,7 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
544
554
  * (bluefox) Implemented option to ignore zero- or/and below zero- values
545
555
 
546
556
  ### 2.2.0 (2021-08-25)
547
- * (Excodibur) Added option to store metadata (q, ack, from) as tags instead of fields for Influx 2.x - see README!
557
+ * (Excodibur) Added an option to store metadata (q, ack, from) as tags instead of fields for Influx 2.x - see README!
548
558
  * (Excodibur) Failure to update/set retention policy will now cause warning instead of error/restart, to support more restrictive DB setups
549
559
  * (Excodibur/Apollon77) Bug fixes and adjustments
550
560
 
@@ -596,13 +606,13 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
596
606
 
597
607
  ### 1.8.2 (2020-04-19)
598
608
  * __Requires js-controller >= 2.0.0__
599
- * (Apollon77) removed usage of adapter.objects
609
+ * (Apollon77) removed usage of `adapter.objects`
600
610
  * (Apollon77) check if objects have changed and ignore unchanged
601
- * (Apollon77) Add Sentry for Error Reporting with js-controller 3.0
611
+ * (Apollon77) Added Sentry for Error Reporting with js-controller 3.0
602
612
  * (Apollon77) Make sure value undefined is ignored
603
613
 
604
614
  ### 1.4.2 (2017-03-02)
605
- * (Apollon77) Add option to define storage datatype per datapoint inclusing converting the value if needed
615
+ * (Apollon77) Added option to define storage datatype per datapoint inclusing converting the value if needed
606
616
 
607
617
  ### 1.3.4 (2017-02-22)
608
618
  * (Apollon77) Small fix for older configurations
@@ -618,8 +628,8 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
618
628
  * (bluefox) Fix handling of float values in Adapter config and Datapoint config.
619
629
 
620
630
  ### 1.3.0 (2016-12-02)
621
- * (Apollon77) Add messages enableHistory/disableHistory
622
- * (Apollon77) add support to log changes only if value differs a minimum value for numbers
631
+ * (Apollon77) Added messages enableHistory/disableHistory
632
+ * (Apollon77) Added support to log changes only if value differs a minimum value for numbers
623
633
 
624
634
  ### 1.2.1 (2016-11)
625
635
  * (Apollon77) small enhancements and fixes
@@ -627,20 +637,20 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
627
637
  ### 1.2.0 (2016-11-05)
628
638
  * (Apollon77) support re-logging also for states that are not updated often (timed relog using relog-Interval)
629
639
  * (Apollon77) try to solve easy type conflicts and convert float <--> boolean if needed
630
- * (Apollon77) enhance getHistory to retrieve also boundary values better by selecting also points outside of the given time boundaries
640
+ * (Apollon77) enhance `getHistory` to retrieve also boundary values better by selecting also points outside of the given time boundaries
631
641
 
632
642
  ### 1.1.1 (2016-11-03)
633
643
  * (Apollon77) small final change on custom dialog
634
644
 
635
645
  ### 1.1.0 (2016-10-29)
636
- * (Apollon77) optimizations and enhancements for high traffic situations
646
+ * (Apollon77) optimizations and enhancements for high-traffic situations
637
647
  * (Apollon77) Bugfix if InfluxDB is unavailable
638
- * (Apollon77) add functions getConflictingPoints and resetConflictingPoints
639
- * (Apollon77) add option to re-log unchanged values to make it easier for visualization
648
+ * (Apollon77) Added functions getConflictingPoints and resetConflictingPoints
649
+ * (Apollon77) Added option to re-log unchanged values to make it easier for visualization
640
650
 
641
651
  ### 1.0.1 (2016-10-18)
642
652
  * (Apollon77) changed storing values to asynchronous way
643
- * (Apollon77) add support for „minmax“ aggregate type on getHistory
653
+ * (Apollon77) Added support for `minmax` aggregate type on getHistory
644
654
 
645
655
  ### 1.0.0 (2016-10-10)
646
656
  * (Apollon77) bulk write into DB
@@ -694,7 +704,7 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
694
704
 
695
705
  The MIT License (MIT)
696
706
 
697
- Copyright (c) 2015-2022 bluefox, apollon77
707
+ Copyright (c) 2015-2024 bluefox, apollon77
698
708
 
699
709
  Permission is hereby granted, free of charge, to any person obtaining a copy
700
710
  of this software and associated documentation files (the "Software"), to deal
@@ -61,7 +61,7 @@
61
61
  "Start or enable adapter first": "Adapter muss zuerst aktiviert werden",
62
62
  "Storage retention": "Aufbewahrungsdauer",
63
63
  "Store as": "Speichern als",
64
- "String": "Zeichenfolge",
64
+ "String": "Text",
65
65
  "Test connection": "Verbindung testen",
66
66
  "This feature can only be used on databases that are empty, or already were setup with this feature enabled. Otherwise it will cause errors (see logs).": "Diese Funktion kann nur für Datenbanken verwendet werden, die leer sind oder bereits mit aktivierter Funktion eingerichtet wurden. Andernfalls kommt es zu Fehlern (siehe Protokolle).",
67
67
  "Token": "Token",