* remove the need to have query feature support
Some InfluxDB servers don't have /query support feature but are still valid servers for storing data.
Usually those servers are proxies to others timeseries databases.
The change proposes to still validate the configuration but with less requirements on the server side.
* `.query` call is replaced by `.write_points`
* no more query call in the influxdb component. remove test
* reset mock after the setup and before the test
* remove unused import
* reset mock stats after component setup
* Add a processing queue to influxdb
* Updates after reviews
* Remove lint
* Move retry loop to thread class
* Move constant calculation out of loop
* Deprecate retry_queue_limit
* Implement data write retry for InfluxDB
This adds an optional max_retries parameter to the InfluxDB component
to specify if and how often the component should try to send the data
if the connection failed due to an IOError.
The sending will be scheduled for a retry in 20 seconds as often as the
user specified. This can be handy for flaky getwork connections between
the DB and Homeassistant or outages like daily DSL reconnects.
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Add unittest for influx write retries
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Add RetryOnError as helper decorator in util
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Add unittests for RetryOnError
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Use RetryOnError decorator in InfluxDB
This replaces the scheduling logic in the InfluxDB component with the
RetryOnError decorator from homeassistant.util
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Make the linters happy
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Implement a queue limit for the retry decorator.
This adds a queue limit to the RetryOnError handler. It limits the
number of calls waiting for be retried. If this number is exceeded,
every new call will discard the oldest one in the queue.
* influxdb: Add the retry queue limit option.
* Make the linter happy.
* Make pylint happy
* Log exception of dropped retry
* Move RetryOnError decorator to influxdb component.
* Fix bug in logging usage
* Fix imports
* Add newlines at the end of files.
* Remove blank line
* Remove blank line
* 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
* 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>
* 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
* Lazy initialise the worker pool
* Minimize pool initialization in core tests
* Fix tests on Python 3.4
* Remove passing in thread count to mock HASS
* Tests: Allow pool by default for threaded, disable for async
* Remove JobPriority for thread pool
* Fix wrong block_till_done
* EmulatedHue: Remove unused test code
* Zigbee: do not touch hass.pool
* Init loop in add_job
* Fix core test
* Fix random sensor test
If a mock's assert_called_once_with method is misspelled (e.g. asert_called_once_with) then the test will appear as passing. Therefore, this commit removes all instances of assert_called_once_with calls and replaces them with two assertions:
self.assertEqual(mock.call_count, 1)
self.assertEqual(mock.call_args, mock.call(call_args))
* 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