lephisto / tesla-apiscraper

API Scraper for pulling Vehicle Statistics from the Tesla Owner API into an InfluxDB + Grafana Dashboards
GNU Lesser General Public License v3.0
365 stars 104 forks source link

add support for external influxDB #49

Closed evanrich closed 5 years ago

evanrich commented 5 years ago

This is going to sound dumb, but can you add support for external influx DB's? I tried doing the following:

edit config.py.dist:

a_influx_host = '10.a.b.c'                 # Set this to influxdb_apiscraper in a Docker environment, otherwise: localhost
a_influx_port = 8086                        # InfluxDB Port
a_influx_user = 'teslaapi'                     # InfluxDB Username
a_influx_pass = 'teslaapipassword'        # InfluxDB Password
a_influx_db = 'tesla'                       # InfluxDB Datebasename

I created a user in my database called teslaapi with the password 'teslaapipassword'

I also tried editing apiscraper.py and hardcoding the values in there. I also tried adding sed's to the start.sh to overwrite /tesla-apiscraper/config.py with my username, password, and database, but this also wouldn't work.

Everything I've tried yeilds the following error:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8086): Max retries exceeded with url: /write?db=tesla (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f01f85e3780>: Failed to establish a new connection: [Errno 111] Connection refused',))

I'm trying to run this in a kubernetes environment, and aalready have an external InfluxDB running, I don't want to run another one if I don't have to. Thanks!

evanrich commented 5 years ago

dissregard, it seems parameter name changed. I added both influxpass and influx_pass (and user/host as well) and now it works