Skip to content

Latest commit

 

History

History
268 lines (183 loc) · 9.21 KB

DOCS.md

File metadata and controls

268 lines (183 loc) · 9.21 KB

Home Assistant Community Add-on: InfluxDB2

InfluxDB is an open source time series database optimized for high-write-volume. It's useful for recording metrics, sensor data, events, and performing analytics. It exposes an HTTP API for client interaction and is often used in combination with Grafana to visualize the data.

This add-on runs the InfluxDB v2.x build channel.
For InfluxDB v1.x build channel, remove this add-on and install https://github.com/hassio-addons/addon-influxdb

Installation

This add-on doesn't come from the commmunity store and needs to be added from a GitHub repository. Don't worry - the process isn't too hard!

  1. Within Home Assistant, navigate to Configuration > ** Add-ons, Backups & Supervisor**
  2. Click ADD-ON STORE > Menu (3 dot elipsis, top right) > Repositories
  3. Add the following Repository: https://github.com/Jays-Home-Assistant-Add-ons/repository
  4. Install the InfluxDB2 add-on
  5. After install, click Start
  6. Check the logs tab to see if everything went well.
  7. Navigate to the interface using

First Run

When running the web UI provided by this add-on for the first time, you'll need to setup an account. Navigate to the interface using the link above and create your first user

Note: If you're planning on pushing Home Assistant data into InfluxDB using the Home Assistant Intergration, then set your first bucket name to be home_asssistant
Refer to Integrating into Home Assistant later in this document

Configuration

Note: Remember to restart the add-on when the configuration is changed.

Example add-on configuration:

reporting: true
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
envvars:
  - name: INFLUXD_LOG_LEVEL
    value: "info"

Note: This is just an example, don't copy and paste it! Create your own!

Option: log_level

The log_level option controls the level of log output by the addon and can be changed to be more or less verbose, which might be useful when you are dealing with an unknown issue. Possible values are:

  • trace: Show every detail, like all called internal functions.
  • debug: Shows detailed debug information.
  • info: Normal (usually) interesting events.
  • warning: Exceptional occurrences that are not errors.
  • error: Runtime errors that do not require immediate action.
  • fatal: Something went terribly wrong. Add-on becomes unusable.

Please note that each level automatically includes log messages from a more severe level, e.g., debug also shows info messages. By default, the log_level is set to info, which is the recommended setting unless you are troubleshooting.

The logging level set here doesn't change the logging level of InfluxDB. Use envvars for that.

Option: reporting

This option allows you to disable the reporting of usage data to InfluxData.

Note: No data from user databases is ever transmitted!

Option: ssl

Enables/Disables SSL (HTTPS) on the web interface. Set it true to enable it, false otherwise.

Note: This does NOT activate SSL for InfluxDB, just the web interface

Option: certfile

The certificate file to use for SSL.

Note: The file MUST be stored in /ssl/, which is the default

Option: keyfile

The private key file to use for SSL.

Note: The file MUST be stored in /ssl/, which is the default

Option: envvars

This allows the setting of Environment Variables to control InfluxDB configuration as documented at:

https://docs.influxdata.com/influxdb/v2.1/reference/config-options

A common one might be to change the logging level of InfluxDB2. For example:

envvars:
  - name: INFLUXD_LOG_LEVEL
    value: "info"

Log levels include: debug, info, error

Note: Changing these options can possibly cause issues with you instance. USE AT YOUR OWN RISK!

These are case sensitive.

Sub-option: name

The name of the environment variable to set which must start with INFLUXDB_

Sub-option: value

The value of the environment variable to set, set the Influx documentation for full details. Values should always be entered as a string (even true/false values).

Option: leave_front_door_open

Adding this option to the add-on configuration allows you to disable authentication on the Web Terminal by setting it to true and leaving the username and password empty.

Note: We STRONGLY suggest, not to use this, even if this add-on is only exposed to your internal network. USE AT YOUR OWN RISK!

Integrating into Home Assistant

The influxdb integration of Home Assistant makes it possible to transfer all state changes to an InfluxDB database.

You need to do the following steps in order to get this working:

  • Navigate to the InfluxDB2 UI using the link under the Installation section of this document.
  • On the left menu click on InfluxDB icon at the top.
  • Navigate to Load Data > API Tokens > + Generate API Token >> Read/Write API Token
  • Set the decription to Home Assistant InfluxDB Intergration API Token
  • Select the home_assistant bucket for both Read & Write << IMPORTANT!!
  • Click Save
  • Click on the name of the newly created token
  • Click Copy to Clipboard ->> This will be required in the yaml below

Now we need to get your organisation ID

Next, add the following snippet to your Home Assistant configuration.yaml file.

influxdb:
  host: localhost
  port: 8086
  api_version: 2
  max_retries: 3
  default_measurement: state
  token: _YOUR_TOKEN_GOES_HERE_
  organization: _YOUR_ORG_ID_GOES_HERE_
  bucket: home_assistant
  ssl: false
  veryify_ssl: false

If you have implimented SSL, you may need to make the following changes to the above configuration:

influxdb:
  host: _CHANGE_TO_YOUR_CERTIFICATE_HOSTNAME_
  ssl: true
  veryify_ssl: true

Restart Home Assistant.

You should now see the data flowing into InfluxDB by visiting the web-interface and using the Data Explorer.

Full details of the Home Assistant integration can be found here:

https://www.home-assistant.io/components/influxdb/

Known issues and limitations

  • InfluxDB2 only supports x64 architecture

Changelog & Releases

This repository keeps a change log using GitHub's releases functionality.

Releases are based on Semantic Versioning, and use the format of MAJOR.MINOR.PATCH. In a nutshell, the version will be incremented based on the following:

  • MAJOR: Incompatible or major changes.
  • MINOR: Backwards-compatible new features and enhancements.
  • PATCH: Backwards-compatible bugfixes and package updates.

Support

Got questions?

You have several options to get them answered:

You could also open an issue here GitHub.

Authors & contributors

The original setup of this repository is by Jay Antoney
The original InfluxDB v1.x add-on that this was based on is by Franck Nijhof

For a full list of all authors and contributors, check the contributor's page.

License

MIT License

Copyright (c) 2022 Jay Antoney

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.