Skip to content

Commit

Permalink
Merge pull request #99 from jasonacox/v0.10.2
Browse files Browse the repository at this point in the history
Fix FleetAPI Setup
  • Loading branch information
jasonacox authored Jun 9, 2024
2 parents dd31f4c + e06ba2c commit 2a6e971
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 6 deletions.
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# RELEASE NOTES

## v0.10.2 - FleetAPI Hotfix

* Fix FleetAPI setup script as raised in https://github.com/jasonacox/pypowerwall/issues/98.
* Update FleetAPI documentation and CLI usage.

## v0.10.1 - TEDAPI Vitals Hotfix

* Fix PVAC lookup error logic in TEDAPI class vitals() function.
Expand Down
2 changes: 1 addition & 1 deletion proxy/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pypowerwall==0.10.1
pypowerwall==0.10.2
bs4==0.0.2
2 changes: 1 addition & 1 deletion pypowerwall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
from typing import Union, Optional
import time

version_tuple = (0, 10, 1)
version_tuple = (0, 10, 2)
version = __version__ = '%d.%d.%d' % version_tuple
__author__ = 'jasonacox'

Expand Down
3 changes: 1 addition & 2 deletions pypowerwall/fleetapi/fleetapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ def __init__(self, configfile=CONFIGFILE, debug=False, site_id=None,
if site_id:
self.site_id = site_id
if not self.site_id:
log.error("No site_id set or returned by FleetAPI.")
raise Exception("No site_id found - Run Setup.")
log.debug("No site_id set or returned by FleetAPI - Run Setup.")

# Function to return a random string of characters and numbers
def random_string(self, length):
Expand Down
46 changes: 44 additions & 2 deletions tools/fleetapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,56 @@ Step 1 - Sign in to Tesla Developer Portal and make an App Access Request: See [

Step 2 - Run the `create_pem_key.py` script and place the **public** key on your website at the URL: https://{DOMAIN}/.well-known/appspecific/com.tesla.3p.public-key.pem

Step 3 - Run SETUP using the `fleetapi` script. This will ask for all the details above, generate a partner token, register your partner account, generate a user token needed to access your Powerwall. It will also get the site_id and run a query to pull live power data for your Powerwall.
Step 3 - Run SETUP using the built in pyPowerwall `fleetapi` setup mode. This will ask for all the details above, generate a partner token, register your partner account, generate a user token needed to access your Powerwall. It will also get the site_id and run a query to pull live power data for your Powerwall.

```bash
python fleetapi.py setup
python -m pypowerall fleetapi
```

Configuration data will be stored in `.pypowerwall.fleetap`.

## Command Line Usage

You can use the command line tool of pypowerwall to monitor and manage your Powerwall vit FleetAPI. Here are the commands:

```
PyPowerwall Module v0.10.2
commands (run <command> -h to see usage information):
fleetapi Setup Tesla FleetAPI for Cloud Mode access
scan Scan local network for Powerwall gateway
set Set Powerwall Mode and Reserve Level
get Get Powerwall Settings and Power Levels
get options:
-format FORMAT Output format: text, json, csv
set options:
-mode MODE Powerwall Mode: self_consumption, backup, or autonomous
-reserve RESERVE Set Battery Reserve Level [Default=20]
-current Set Battery Reserve Level to Current Charge
```

Examples

```bash
# Setup
python3 -m pypowerwall fleetapi

# Get Current Status
python3 -m pypowerwall get

# Set battery reserve level to 30%
python3 -m pypowerwall set -reserve 30

# Set Powerwall mode to autonomous TOU
python3 -m pypowerwall set -mode autonomous

```

## Stand Alone Tools

The `fleetapi.py` script is a command line utility and python class that you can use to monitor and manage your Powerwall. Here are teh command lines:

```
Expand Down

0 comments on commit 2a6e971

Please sign in to comment.