liveaverage / docker-powerwall-dashboard

Grafana dashboard showing trend & historical data polled from Tesla Powerwall 2 API served up in an easy to use docker image
GNU General Public License v3.0
29 stars 9 forks source link

Multiarch updates #17

Closed liveaverage closed 3 years ago

liveaverage commented 3 years ago
natrlhy commented 3 years ago

I'm not sure what I'm doing wrong, but I'm using a docker-compose.yml file. I haven't modified it at all, but when I pull the latest and check the logs I see this:

M PowerwallData.autogen.http WHERE (url = 'https://teslapw/api/meters/aggregates') AND time >= 451543h GROUP BY time(1m)"
ts=2021-07-06T17:28:46.050189Z lvl=info msg="Executing query" log_id=0VBDJS6l000 service=query query="SELECT mean(solar_instant_power) AS solar FROM PowerwallData.autogen.http WHERE (url = 'https://teslapw/api/meters/aggregates') AND time >= 451543h GROUP BY time(1m)"
ts=2021-07-06T17:28:46.051210Z lvl=info msg="Executing query" log_id=0VBDJS6l000 service=query query="SELECT mean(load_instant_power) AS home FROM PowerwallData.autogen.http WHERE (url = 'https://teslapw/api/meters/aggregates') AND time >= 451543h GROUP BY time(1m)"
[httpd] 10.10.10.3, 10.10.10.3,127.0.0.1 - - [06/Jul/2021:17:28:46 +0000] "GET /query?db=PowerwallData&epoch=ms&q=SELECT+mean%28%22site_instant_power%22%29+FROM+%22http%22+WHERE+%28%22url%22+%3D+%27https%3A%2F%2Fteslapw%2Fapi%2Fmeters%2Faggregates%27%29+AND+time+%3E%3D+1625554800000ms+GROUP+BY+time%281m%29+fill%28null%29%3BSELECT+mean%28%22battery_instant_power%22%29+FROM+%22http%22+WHERE+%28%22url%22+%3D+%27https%3A%2F%2Fteslapw%2Fapi%2Fmeters%2Faggregates%27%29+AND+time+%3E%3D+1625554800000ms+GROUP+BY+time%281m%29+fill%28null%29%3BSELECT+mean%28%22solar_instant_power%22%29+AS+%22solar%22+FROM+%22http%22+WHERE+%28%22url%22+%3D+%27https%3A%2F%2Fteslapw%2Fapi%2Fmeters%2Faggregates%27%29+AND+time+%3E%3D+1625554800000ms+GROUP+BY+time%281m%29+fill%28null%29%3BSELECT+mean%28%22load_instant_power%22%29+AS+%22home%22+FROM+%22http%22+WHERE+%28%22url%22+%3D+%27https%3A%2F%2Fteslapw%2Fapi%2Fmeters%2Faggregates%27%29+AND+time+%3E%3D+1625554800000ms+GROUP+BY+time%281m%29+fill%28null%29 HTTP/1.1" 200 68 "-" "Grafana/7.5.2" 9e264931-de7f-11eb-80e0-0242ac130002 7237
2021-07-06T17:28:50Z E! [inputs.http] Error in plugin: [url=https://powerwall/api/meters/aggregates]: Get "https://powerwall/api/meters/aggregates": dial tcp: lookup powerwall on 127.0.0.11:53: no such host
2021-07-06T17:28:50Z E! [inputs.http] Error in plugin: [url=https://powerwall/api/system_status/soe]: Get "https://powerwall/api/system_status/soe": dial tcp: lookup powerwall on 127.0.0.11:53: no such host
root@powerdash:~/docker/PowerDash#

When I login to the container, I can ping the teslapw hostname just fine so I'm not sure why the logs refer to a host called powerwall...

This is my docker-compose.yml file:


version: '3.3'
services:
    powerwall-dashboard:
        restart: always
        container_name: powerdash
        extra_hosts:
            - 'teslapw:10.10.10.70'
        ports:
            - '3000:3000'
        environment:
            - POWERWALL_PASS=mypass
            - POWERWALL_LOCATION=lat=67.713501&lon=-141.866821
            - GRAFANA_DASHBOARD_URL=https://raw.githubusercontent.com/liveaverage/docker-powerwall-dashboard/master/graf_dash.json
        volumes:
            - './influx-data:/var/lib/influxdb'
            - './grafana-data:/var/lib/grafana'
        image: liveaverage/powerwall-dashboard:latest
liveaverage commented 3 years ago

@natrlhy try purging (or temporarily moving) your local grafana directory (./grafana-data) and restarting the container: mv ./grafana-data ./grafana-data-bak; mkdir ./grafana-data. The referenced dashboard URL has been updated, but your grafana.db might have a stale copy: https://github.com/liveaverage/docker-powerwall-dashboard/blob/master/graf_dash.json#L131

natrlhy commented 3 years ago

@liveaverage Ok, I've tried that but it's still not getting any data, even with the Powerwall History dashboard pulled down.

[httpd] 127.0.0.1 - - [06/Jul/2021:17:45:19 +0000] "POST /write?db=telegraf HTTP/1.1 " 204 0 "-" "Telegraf/1.19.0 Go/1.16.5" ee10407e-de81-11eb-80b3-0242ac140002 19077
[httpd] 127.0.0.1 - - [06/Jul/2021:17:45:19 +0000] "POST /write?db=PowerwallData HTTP/1.1 " 204 0 "-" "Telegraf/1.19.0 Go/1.16.5" ee105421-de81-11eb-80b4-0242ac140002 18584
2021-07-06T17:45:20Z E! [inputs.http] Error in plugin: [url=https://powerwall/api/meters/aggregates]: Get "https://powerwall/api/meters/aggregates": dial tcp: lookup powerwall on 127.0.0.11:53: no such host
2021-07-06T17:45:20Z E! [inputs.http] Error in plugin: [url=https://powerwall/api/system_status/soe]: Get "https://powerwall/api/system_status/soe": dial tcp: lookup powerwall on 127.0.0.11:53: no such host
[httpd] 127.0.0.1 - - [06/Jul/2021:17:45:29 +0000] "POST /write?db=telegraf HTTP/1.1 " 204 0 "-" "Telegraf/1.19.0 Go/1.16.5" f4061752-de81-11eb-80b5-0242ac140002 15922
[httpd] 127.0.0.1 - - [06/Jul/2021:17:45:29 +0000] "POST /write?db=PowerwallData HTTP/1.1 " 204 0 "-" "Telegraf/1.19.0 Go/1.16.5" f4064461-de81-11eb-80b6-0242ac140002 19604
2021-07-06T17:45:30Z E! [inputs.http] Error in plugin: [url=https://powerwall/api/system_status/soe]: Get "https://powerwall/api/system_status/soe": dial tcp: lookup powerwall on 127.0.0.11:53: no such host
2021-07-06T17:45:30Z E! [inputs.http] Error in plugin: [url=https://powerwall/api/meters/aggregates]: Get "https://powerwall/api/meters/aggregates": dial tcp: lookup powerwall on 127.0.0.11:53: no such host
liveaverage commented 3 years ago

you need to update your host ref teslapw to powerwall in your compose file .... due to Tesla SNI changes you either need to use the IP or valid SAN on the self-signed certificate associated with the backup gateway/powerwall (powerwall in this case). I opted for a valid SAN since it abstracts things a bit.

natrlhy commented 3 years ago

Sweet! Thanks. Makes sense now. Got that updated and data is flowing in now. I referenced your dashboard and am now updating a custom dashboard I had and removing the URL references:

image

Looking good! Thanks for the help and changes!

blharveymi commented 3 years ago

advice on how to run both this and the teslamate for doing solar and vehicle data? both use grafana and need port 3000

liveaverage commented 3 years ago

@blharveymi the simple, short-term fix is to expose/publish a non-overlapping port using docker. The container will still listen on TCP3000, but it will be exposed/published on whatever port you'd like on the docker host:

docker run --detach --name powerwall-dashboard --restart always \
        --add-host powerwall:${POWERWALL_IP} \
        -e "GRAFANA_DASHBOARD_URL=${GRAFANA_DASHBOARD_URL}" \
        -e "POWERWALL_HOST=powerwall" \
        -e "POWERWALL_PASS=${POWERWALL_PASS}" \
        -e "POWERWALL_LOCATION=${GRAFANA_WEATHER_LOCATION}" \
        -p 4000:3000 \                                     ##### <<<< Map TCP 3000 on the container to TCP 4000 on the docker host
        -v ${LOCAL_INFLUXDB_PATH}:/var/lib/influxdb:z \
        -v ${LOCAL_GRAFANA_PATH}:/var/lib/grafana:z \
        liveaverage/powerwall-dashboard:multiarch

A better long-term solution is to use a reverse proxy if you're hosting multiple containers/apps on the same host. I'd recommend something like jwilder's NGINX container, which will auto-discover and publish containers on your docker host: https://github.com/nginx-proxy/nginx-proxy

blharveymi commented 3 years ago

thanks.

is there a reason we are pulling from the local TEG instead of just pulling the tesla energy API like sites do for the vehicle information?

I would like to move this off of my local mac mini and into AWS account.

liveaverage commented 3 years ago

For me it's preference -- I can still obtain stats during a sustained ISP outage. The LTE connectivity on my Backup Gateway is spotty at best, but I live in a rural area, too. I'll look into shifting calls to Tesla's API directly, but if the same details aren't available (with/without an outage) at the same frequency as scraping the TEG I likely won't pursue the swap. I'm not a Tesla vehicle owner (and honestly wouldn't have been a Powerwall owner had the installer not swapped out the originally spec'd LG Chem for the Powerwall), so no real exposure to the publicly accessible API.

blharveymi commented 3 years ago

I will see if I can share what I did before that was being pulled by a lambda function last year. I just never setup graphs for it yet.

Sent from my iPhone

On Jul 6, 2021, at 7:20 PM, J.R. Morgan @.***> wrote:

 For me it's preference -- I can still obtain stats during a sustained ISP outage. The LTE connectivity on my Backup Gateway is spotty at best, but I live in a rural area, too. I'll look into shifting calls to Tesla's API directly, but if the same details aren't available (with/without an outage) at the same frequency as scraping the TEG I likely won't pursue the swap. I'm not a Tesla vehicle owner (and honestly wouldn't have been a Powerwall owner had the installer not swapped out the originally spec'd LG Chem for the Powerwall), so no real exposure to the publicly accessible API.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.