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

New install, four errors (db error, 504 gateway, Grafana-trackmap, range) #70

Open cwanja opened 5 years ago

cwanja commented 5 years ago

Hello,

Setup the API scrapper on a Raspberry Pi 3 B+ last night and enjoy the data from my first drive. However, I have some issues:

  1. It seems that it stopped talking to my car today with the following errors:
    2019-08-28 13:57:08 INFO     >> self.connection.refresh_vehicle()
    INFO:apiscraper:>> self.connection.refresh_vehicle()
    2019-08-28 13:57:09 INFO     Asleep since: 0 Sleeping for 2048.0 seconds..
    INFO:apiscraper:Asleep since: 0 Sleeping for 2048.0 seconds..
    Exception in thread elevator:
    Traceback (most recent call last):
    File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
    File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
    File "/home/pi/Documents/tesla-apiscraper/srtmread.py", line 29, in elevationtoinflux
    ifclient.write_points(elev_json_body)
    File "/usr/lib/python3/dist-packages/influxdb/client.py", line 402, in write_points
    tags=tags)
    File "/usr/lib/python3/dist-packages/influxdb/client.py", line 447, in _write_points
    expected_response_code=204
    File "/usr/lib/python3/dist-packages/influxdb/client.py", line 289, in write
    headers=headers
    File "/usr/lib/python3/dist-packages/influxdb/client.py", line 259, in request
    raise InfluxDBClientError(response.content, response.status_code)
    influxdb.exceptions.InfluxDBClientError: 400: {"error":"unable to parse 'drive_state,display_name=[Tesla Car],vin=[VIN]  [string of numbers]': invalid field format"}

If you need the string of numbers, let me know.

  1. Also, scrolling through the errors, I am seeing that there are a lot of the following: 2019-08-28 15:33:03 INFO HTTP Error: HTTP Error 504: Gateway Timeout

Is that my issue, Tesla's API, my installation, something else?

  1. How can I get the grafana-trackmap-panel installed? When I went through the instructions, NPM was throwing errors and it said that it was likely what the version the developer had and not NPM. Right now when I try to load the Geolocation panel it says "Panel plugin not found: pr0ps-trackmap-panel". Have tried to run sudo grafana-cli plugins install pr0ps-trackmap-panel and sudo grafana-cli plugins remove pr0ps-trackmap-panel to no avail. More details posted below:
    
    npm install
    (node:1357) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
    npm ERR! Error: Method Not Allowed
    npm ERR!     at errorResponse (/usr/share/npm/lib/cache/add-named.js:260:10)
    npm ERR!     at /usr/share/npm/lib/cache/add-named.js:203:12
    npm ERR!     at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:167:7)
    npm ERR!     at FSReqWrap.oncomplete (fs.js:135:15)
    npm ERR! If you need help, you may report this *entire* log,
    npm ERR! including the npm and node versions, at:
    npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 4.19.66-v7+ npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" npm ERR! cwd /var/lib/grafana/plugins/grafana-trackmap-panel npm ERR! node -v v8.11.1 npm ERR! npm -v 1.4.21 npm ERR! code E405 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /var/lib/grafana/plugins/grafana-trackmap-panel/npm-debug.log npm ERR! not ok code 0



4. When looking at the TeslaMetric v2 and Charging dashboards, the "Current [ideal] Range" shows at 999.00mi". Any way to get this to reflect the true range?

I did a "manual" install. Not in docker, currently running as an open process in a terminal window. 

Assistance is greatly appreciate! 
KSAdk commented 4 years ago

Regarding 3) I was struggling with the same. Apparently, it is not enough to install npm using apt-get. You need to ensure that the latest version is used: $ sudo npm install -g npm@latest

Also, once you have checked out the plugin, you need to update all the dependency packages in /var/lib/grafana/plugins/grafana-trackmap-panel/package.json

$ sudo npm i npm-update-all -g
$ sudo npm-update-all
$ sudo npm update caniuse-lite browserslist

I have created a PR for the README.md on the matter and more: https://github.com/lephisto/tesla-apiscraper/pull/82