Skip to content

Commit

Permalink
Final Commit before Images
Browse files Browse the repository at this point in the history
  • Loading branch information
BJReplay committed Oct 23, 2023
1 parent 56e62ca commit 56395cb
Showing 1 changed file with 27 additions and 196 deletions.
223 changes: 27 additions & 196 deletions WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ You should see something like this - note the link/ether and inet values for eth
```

Grab the mac address listed, and use this to set up a DHPC reservation in your router with a hostname (e.g. wsl2) and update your .wslconfig file with this mac address, and uncomment the line.
`wsl --shutdown` to shutdown WSL, then restart, and WSL should come up on the DHCP allocated IP address, and if you log in, `ip a` should show the new IP address. You probably can't ping it yet, without Windows Firewall changes, but it's there on that IP.
`wsl --shutdown` to shutdown WSL, then restart, and WSL should come up on the DHCP allocated IP address, and if you log in, `ip a` should show the new IP address.

Open up the firewall port that Grafana will use, so that it's ready on first run, for later: **administrator** command prompt `netsh advfirewall firewall add rule name= "Powerwall-Dashboard" dir=in action=allow protocol=TCP localport=9000`
Open up the firewall port that Grafana will use, so that it's ready on first run, for later: **administrator** command prompt:
`netsh advfirewall firewall add rule name= "Powerwall-Dashboard" dir=in action=allow protocol=TCP localport=9000`

### Docker Setup

Expand Down Expand Up @@ -149,200 +150,30 @@ systemctl status docker.service
systemctl status containerd.service
```

### Create Windows Task Schedule Task to Restart WSL

* Create a Task (don't choose Basic Task, so you can correctly set all the options) - see example screenshots below
* Make sure you use the account that has set up WSL and this account has a pssword
* Choose Run whether user is logged on or not
* Configure for Windows 10
* Name the task Windows 10
* Set up two triggers
* Startup - Delay task for 1 Minute - to give Windows time to Boot
* Statup - Delay task for 5 Minutes - this is a back up for the first task, just in case.
* Set up one action
* Start a program
* `wsl` for the program
* Replace <YOURUSERNAME> in the argument `-u root -e sh -c "touch startup.log && service docker start && tmux new-session -d -s keepalive && /home/user/<YOURUSERNAME>/Powerwall-Dashboard/backfill.sh"`
* Modify the Conditions
* Default Conditions should be OK - see example image below
* Modify the Settings
* Allow Task to be Run on Demand
* Shutdown WSL
* Test the Task - WSL should Start



### Powerwall-Dashboard Installation
Run the remainder of the Powerwall Dashboard Installation as per the Quick Start or Manual Installation
https://github.com/jasonacox/Powerwall-Dashboard#option-1---quick-start






Clone this repo on the host that will run the dashboard:

```bash
git clone https://github.com/jasonacox/Powerwall-Dashboard.git
```

## Option 1 - Quick Start

Run the interactive setup script that will ask you for your Powerwall details and Local *timezone*. To find your timezone, see the second column in this table: [https://en.wikipedia.org/wiki/List_of_tz_database_time_zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List).

```bash
cd Powerwall-Dashboard
./setup.sh
```

* _If you get docker errors during the setup, see the [Docker Errors](https://github.com/jasonacox/Powerwall-Dashboard#docker-errors) section below._
* _For Windows 11 users, see the [Windows 11 Instructions](https://github.com/jasonacox/Powerwall-Dashboard#windows-11-instructions) below._

Follow the **[Grafana Setup](https://github.com/jasonacox/Powerwall-Dashboard#grafana-setup)** instructions provided (or see below) to complete the setup.

## Option 2 - Manual Install

If you prefer, you can perform the same steps that `setup.sh` performs.

Note: some manual configuration is required if you are running a non-standard docker installation (e.g. rootless). Also, ensure that the `conf`, `env` and `sql` files are readable by the docker services (e.g. `chmod 644`).

You will want to set your local timezone by editing `pypowerwall.env`, `telegraf.conf`, `influxdb.sql` and `dashboard.json` or you can use this handy `tz.sh` update script. A list of timezones is available here: [TZ Table](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

```bash
# Replace with your timezone
bash tz.sh "America/Los_Angeles"
```

### Docker Containers

* Copy `pypowerwall.env.sample` to `pypowerwall.env` and update the following details for your Powerwall:

```bash
PW_EMAIL=email@example.com
PW_PASSWORD=password
PW_HOST=192.168.91.1
PW_TIMEZONE=America/Los_Angeles
PW_DEBUG=no
```

* Copy `compose.env.sample` to `compose.env` - you do not need to edit these defaults unless you are running a non-standard install such as docker rootless.

* Copy `telegraf.local.sample` to `telegraf.local`. If you want to monitor custom measurements for your site (most users don't need this), add the required telegraf.conf TOML entries to this file. Once created, this file is not overwritten by upgrades or future runs of setup.sh.

* Copy `grafana.env.sample` to `grafana.env` - you do not need to edit these defaults. However, there are optional settings for alert notifications and HTTPS.

* Optional: If you want to pull in local weather data, copy `weather/weather411.conf.sample` to `weather/weather411.conf` and edit the file to include your location ([Latitude and Longitude](https://jasonacox.github.io/Powerwall-Dashboard/location.html)) and your OpenWeatherMap API Key. To get a Key, you need to set up a free account at [openweathermap.org](https://home.openweathermap.org/users/sign_up). Make sure you check your email to verify account. API keys can take a few hours to activate.

```conf
[OpenWeatherMap]
# Register and get APIKEY from OpenWeatherMap.org
APIKEY = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# Enter your location in latitude and longitude
LAT = xxx.xxxx
LON = yyy.yyyy
```

* Start the docker containers with the utility docker-compose script

```bash
./compose-dash.sh up -d
```

### InfluxDB

* Connect to the Influx database to import setup commands:

```bash
docker exec -it influxdb influx -import -path=/var/lib/influxdb/influxdb.sql
```

Note: It can take a while for InfluxDB to start. Also the influxdb.sql file is set to use `America/Los_Angeles` as timezone. Use the `tz.sh` script or manually update the database commands above to replace `America/Los_Angeles` with your own timezone.

## Grafana Setup

* Open up Grafana in a browser at `http://<server ip>:9000` and login with `admin/admin`

* From `Configuration\Data Sources` add `InfluxDB` database with:
- Name: `InfluxDB`
- URL: `http://influxdb:8086`
- Database: `powerwall`
- Min time interval: `5s`
- Click "Save & test" button

* From `Configuration\Data Sources` add `Sun and Moon` database with:
- Name: `Sun and Moon`
- Enter your latitude and longitude. You can use this [web page](https://jasonacox.github.io/Powerwall-Dashboard/location.html) to find your GPS location if you don't know).
- Click "Save & test" button

* From `Dashboard\Browse` select `New/Import`, and upload one of the dashboard files below (in [dashboards folder](https://github.com/jasonacox/Powerwall-Dashboard/tree/main/dashboards)):

1. `dashboard.json` - Dashboard with the live trend graph, monthly power graphs, an animated power flow diagram and a Powerwall+ section that includes String data, temperature, voltage and frequency graphs. This also includes a "grid status" graph below the animation to identify and track grid outages.
2. `dashboard-no-animation.json` - Similar to above but without the animated power flow diagram.
3. `dashboard-simple.json` - Similar to above but without the Powerwall+ metrics.

### Notes

* The database queries are set to use `America/Los_Angeles` as the timezone. Remember to edit the database commands [influxdb.sql](influxdb/influxdb.sql) and [powerwall.yml](powerwall.yml) with your own timezone. During import of dashboards into Grafana you'll be prompted to enter your timezone for queries.

### Upgrading

* The included `upgrade.sh` script will attempt to upgrade your installation to the latest Powerwall-Dashboard version without removing existing data. A backup is still recommended.

### Troubleshooting Tips and Tricks

Check the logs of the services using:

```bash
docker logs -f pypowerwall
docker logs -f telegraf
docker logs -f influxdb
docker logs -f grafana
```

* Docker terminating with `error 139`: InfluxDB does not run reliably on older models of Raspberry Pi.
* Grafana Error: Invalid interval string, expecting a number followed by one of "Mwdhmsy" - This indicates that the Grafana setup for InfluxDB is missing the time unit, "s", in the "Min time interval" field:
- Min time interval: `5s`

#### Missing Powerwalls or String data?

* String data only shows up for Tesla inverters as part of Powerwall+ systems. Unfortunately, non-Tesla inverter data is not available via the Tesla API. If you find a way to pull this data, please submit an Issue or Pull Request to get it added.
* The default dashboard and InfluxDB setup supports up to 12 Tesla Powerwalls. Support for more can be added by editing the [dashboard.json](dashboards/dashboard.json) and [influxdb.sql](influxdb/influxdb.sql) files. Open an Issue and we can help (see [#2](https://github.com/jasonacox/Powerwall-Dashboard/issues/2)).

#### Docker Errors

If you are getting permission errors running docker, or an error that it isn't installed:
* Ensure docker is installed for your OS (run `docker version` to test)
* If you see permission denied, add your user to the docker group and reboot your system:
```bash
# Add your user to docker group
sudo usermod -aG docker $USER
```
* If the above step hasn't worked, and you get an error trying to run `docker info` like `permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock`:
```bash
# Grant permissions to the docker daemon socket
sudo chmod 666 /var/run/docker.sock
```
* If you can't access the dashboard after a reboot, that means that docker was not set to start on reboot. On many OS distributions you can set it to start on boot with:
```bash
# Set docker to start on boot
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
```
* See [Docker install here](https://docs.docker.com/engine/install/linux-postinstall/) for more information.
* If you have docker installed but get "ERROR: docker-compose is not available or not running" make sure it is in your PATH or if needed, install the docker-compose cli tool:
```bash
# install
sudo pip3 install docker-compose

# test
docker-compose --version
```

#### Savings Errors

The savings estimates are based on a $0.19/kWh (by default) utility cost and net metering credit. You likely have a different value for this and during importing dashboards indicate your average cost per kWh to reflect your actual costs and credits. As of now there's one variable to set both cost and credit per kWh. To help, here are the variables used to calculate the savings:

* `s` = kWh from solar (based on time frame selected)
* `fp` = kWh from powerwall
* `tp` = kWh to powerwall
* `tg` = kWh to grid

The equations that are used to compute the estimated savings:

* `powerwall>home` = `fp` * `$/kWh` [assumes all power to home from PW = savings]
* `solar>home` = (`s` - `tp` - `tg`) * `$/kWh` [assumes all solar not going to PW or grid is going to the home = savings]
* `solar>grid` = `tg` * `$/kWh` [assumes all power going to grid = savings]

#### Synology NAS and Rootless Docker

* If you are having trouble getting this to work on a Synology NAS, view the resolution discovered in [Issue #22](https://github.com/jasonacox/Powerwall-Dashboard/issues/22) thanks to @jaydkay.
* If you are running docker as a non-privileged (rootless) user, please some setup help [here](https://github.com/jasonacox/Powerwall-Dashboard/issues/22#issuecomment-1254699603) thanks to @BuongiornoTexas.
* Most of the issues running the Dashboard on Synology NAS are related to user or file permission issues. Ensure that the `conf`, `env` and `sql` files are readable by the docker services (most can be set `chmod 644`).

#### Windows 11 Instructions

Installing Powerwall-Dashboard on a Windows 11 host requires some additional setup. Install and Setup using administrator PowerShell or Windows Command Prompt:

* Install WSL (wsl --install) with an OS (recommend Ubuntu)
* Install *Git for Windows* (https://gitforwindows.org/)
* Install *Docker Desktop* for Windows (https://www.docker.com/)
* From *Git Bash* prompt, Clone repo (`git clone https://github.com/jasonacox/Powerwall-Dashboard.git`)
* Run `cd Powerwall-Dashboard`
* Run `./setup.sh`

0 comments on commit 56395cb

Please sign in to comment.