* Allow reporting some state attributes as tags to InfluxDB
Some state attributes should really be tags in InfluxDB. E.g.
it is helpful to be able to group by friendly_name, or add a custom
attribute like "location" and group by that. Graphs in Grafana are much
easier to read when friendly names are used, and not node ids.
This commit adds an optional setting to InfluxDB config:
'tags_attributes'. Any attribute on this list will be reported as tag
and not as field to InfluxDB.
* Allow overriding InfluxDB measurement for each reported item separately
Bundling all items with the same "unit of measurement" together does not
always makes sense. For example, both "relatively humidity" and "battery
level" are reported as "%", but I'd rather see them as separate
measurements in InfluxDB. This commit allows for 'influxdb_measurement'
attribute. When set on node, it will take precedence over the global
'override_measurement' and component-specific 'unit_of_measurement'.
* Minor updates to InfluxDB component improvements, as suggested by
@MartinHjelmare.
* Moved per-component config from 'customize' into 'influxdb'
configuration section. The following three sub-sections were added:
'component_config', 'component_config_domain' and
'component_config_glob'. The sole supported per-component attribute
at this point is 'override_measurement'.
* Lint
* Fixed mocked entity_ids in InfluxDB tests to be in domain.entity_id
format, to satisfy EntityValues requirements.
* Added tests for new InfluxDB configuration parameters
* Fixes to some docstrings
* Update InfluxDB to handle datetime objects
Updates the InfluxDB regex to ignore datetime objects being coverted
into float values.
Adds tests to the component to ensure datetime objects are corectly
handled.
* Fix Hound errors
Fixes errors from Hound bot
* Update InfluxDB to handle multiple decimal points
Changes the way InfluxDB handles values such as 1.2.3.4 to be 1.234 so
it stores in InfluxDB as a valid float value
* Fix lint issues
Reduce the size of a line for the linter
* Update InfluxDB to pass on unknown variable
If we get an error trying to convert a variable to a float, let's ignore
it completely
* Make InfluxDB Regex constants
Makes the Regex's used by InfluxDB constants so they don't need to be
compiled each time
* cleanup
* fix lint
* Update regex
* fix tests
* Fix JSON body missing new line character
* fix exceptions
* Make percentage string values as floats in InfluxDB
Currently Z-wave and other compontents report an attributes battery
level as an integer, for example
```yaml
{
"is_awake": false,
"battery_level": 61,
}
```
However, some other components like Vera add the battery level as a
string
```yaml
{
"Vera Device Id": 25,
"device_armed": "False",
"battery_level": "63%",
"device_tripped": "False",
}
```
By removing any % signs in the field, this will send the value to
InfluxDB as an int, which can then be used to plot the data in graphs
correctly, like other percentage fields.
* Add tests and remove all trailing non digits
Adds tests and now removes all trailing non-numeric characters for
better use
* Update variable name for InfluxDB digit checks
Updates the variable used for the regex to remove trailing non digits
* Fix linting errors for InfluxDB component
Fixes a small linting error on the InfluxDB component
SHOW DIAGNOSTICS always needs admin privileges on influxdb. For
the purposes of home-assistant this is too much.
Use 'SHOW SERIES' to have a relatively lightweight query which
only needs READ privileges.
* Allow InfluxDB to blacklist domains
This adds an option to InfluxDB to blacklist whole domains. This is
useful for domains like automation or script, where no statistic data
is needed.
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Add unittest for InfluxDB domain blacklist
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Use common include/exclude config for InfluxDB.
Its now the same syntax as it is for recorder.
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Add unittests for InfluxDB include whitelist.
There where no tests for that feature before.
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Fix: replace influxdb query by another query that is more lightweight and won't timeout
* Fix: replace influxdb query by another query that is more lightweight and won't timeout
* Revert #4791 and fixes#4696
* Update influxDB based on PR comments
* Add migration script
* Update influxdb_migrator based on PR comments
* Add override_measurement option to influxdb_migrator
* Rename value field to state when data is string type
* Fix influxdb cloning query
* Fixed attributes that are lists cuasing invalid influx syntax
* Added bool and fixed mixed data type issue
* Fixed changing nearly all data types to float causing some worse influxdb errors. whoops
* Added line to end of file
* Relaxes the configuration options for influxdb
By default influxdb allows unauthenticated access
Home Assistant required at least username and password to be present to properly submit data to influxdb
* Removes unused import of 'copy'
The copy module was used only in the removed test case responsible for testing the missing keys
* Updates InfluxDB config schema to require user and password
Current InfluxDB (v 1.0) can work without any authentication, but when authentication is enabled both username and password should be set.
* Removes extra white space in test_influxdb.py
* Add STATE_UNAVAILABLE to states that are ignored when writing to the
database. This will avoid a field type error for string if the field
already contains a different type, eg integer.
* Add test for ignored states for influxdb.
* Clean up influxdb tests.
This adds tests for the influxdb component. It also fixes a bug,
where username and password are required, but not gracefully
handled if they're missing from config.
Use select statment to show if db exits instead of
'SHOW DATABASES' which cant be run by a non admin user.
See https://github.com/influxdata/influxdb/issues/4785 for more info.
Also influxdb dont like empty writes('') so ignore state changes of that kind,
this happens on startup of home assistant.
Signed-off-by: Robert Marklund <robbelibobban@gmail.com>