Skip to content

Commit efd24ef

Browse files
janLofabaff
authored andcommitted
Add documentation for the InfluxDB import script (home-assistant#2491)
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
1 parent f289a00 commit efd24ef

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

source/_components/influxdb.markdown

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,62 @@ optional arguments:
9898
- The step option defaults to `1000`.
9999

100100

101+
## {% linkable_title Data import script %}
102+
103+
If you want to import all the recorded data from your recorder database you can use the data import script.
104+
It will read all your state_change events from the database and add them as data-points to the InfluxDB.
105+
You can specify the source database either by pointing the `--config` option to the config directory which includes the default sqlite database or by giving a sqlalchemy connection URI with `--uri`.
106+
The writing to InfluxDB is done in batches that can be changed with `--step`.
107+
108+
You can control, which data is imported by using the commandline options `--exclude-entities` and `--exclude-domain`.
109+
Both get a comma separated list of either entity-ids or domain names that are excluded from the import.
110+
111+
To test what gets imported you can use the `--simulate` option, which disables the actual write to the InfluxDB instance.
112+
This only writes the statistics how much points would be imported from which entity.
113+
114+
Example to run the script:
115+
116+
```bash
117+
$ hass --script influxdb_import --config CONFIG_DIR \
118+
-H IP_INFLUXDB_HOST -u INFLUXDB_USERNAME -p INFLUXDB_PASSWORD \
119+
--dbname INFLUXDB_DB_NAME --exclude-domain automation,configurator
120+
```
121+
Script arguments:
122+
123+
```
124+
required arguments:
125+
-d dbname, --dbname dbname
126+
InfluxDB database name
127+
128+
optional arguments:
129+
-h, --help show this help message and exit
130+
-c path_to_config_dir, --config path_to_config_dir
131+
Directory that contains the Home Assistant
132+
configuration
133+
--uri URI Connect to URI and import (if other than default
134+
sqlite) eg: mysql://localhost/homeassistant
135+
136+
-H host, --host host InfluxDB host address
137+
-P port, --port port InfluxDB host port
138+
-u username, --username username
139+
InfluxDB username
140+
-p password, --password password
141+
InfluxDB password
142+
-s step, --step step How many points to import at the same time
143+
-t tags, --tags tags Comma separated list of tags (key:value) for all
144+
points
145+
-D default_measurement, --default-measurement default_measurement
146+
Store all your points in the same measurement
147+
-o override_measurement, --override-measurement override_measurement
148+
Store all your points in the same measurement
149+
-e exclude_entities, --exclude_entities exclude_entities
150+
Comma separated list of excluded entities
151+
-E exclude_domains, --exclude_domains exclude_domains
152+
Comma separated list of excluded domains
153+
-S, --simulate Do not write points but simulate preprocessing
154+
and print statistics
155+
```
156+
101157
## {% linkable_title Examples %}
102158

103159

0 commit comments

Comments
 (0)