Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.10.0 - New Device Vitals #95

Merged
merged 10 commits into from
Jun 3, 2024
Merged

v0.10.0 - New Device Vitals #95

merged 10 commits into from
Jun 3, 2024

Conversation

jasonacox
Copy link
Owner

@jasonacox jasonacox commented Jun 2, 2024

Device Vitals via TEDAPI

Updates

  • Add support for /tedapi API access on Gateway (requires connectivity to 192.168.91.1 GW and Gateway Password) with access to "config" and "status" data.
  • Adds drop-in replacement for depreciated /vitals API and payload using the new TEDAPI class. This allows easy access to Powerwall device vitals.
  • Proxy update to t58 to support TEDAPI with environmental variable PW_GW_PWD for Gateway Password in preparation for onboarding into Powerwall-Dashboard - Test (beta) proxy available for power users:
    • Edit powerwall.yml and use jasonacox/pypowerwall:0.10.0t58-beta6
    • Edit pypowerwall.env and edit PW_HOST and add PW_GW_PWD
    • Create a network route to your Powerwall Gateway: sudo ip route add 192.168.91.0/24 via <Powerwall_LAN_IP>
    • This may not work on Powerwall 3 systems (please test and let me know)

Coding Examples

# How to Activate the TEDAPI Mode
import pypowerwall

gw_pwd = "GW_PASSWORD" # Gateway Passowrd usually on QR code on Gateway

host = "192.168.91.1" # Direct Connect to GW
pw = pypowerwall.Powerwall(host,password,email,timezone,gw_pwd=gw_pwd)
print(pw.vitals())
# New TEDAPI Class
import pypowerwall.tedapi

tedapi = pypowerwall.tedapi.TEDAPI("GW_PASSWORD")

config = tedapi.get_config()
status = tedapi.get_status()

meterAggregates = status.get('control', {}).get('meterAggregates', [])
for meter in meterAggregates:
    location = meter.get('location', 'Unknown').title()
    realPowerW = int(meter.get('realPowerW', 0))
    print(f"   - {location}: {realPowerW}W")

Related Issues and Discussions:

@jasonacox
Copy link
Owner Author

jasonacox commented Jun 2, 2024

Nice to see the Alert and Island voltage/frequency data back:

image

Discovered problem with POD_nom_energy_remaining and POD_nom_full_pack_energy data and also added a computed POD_nom_energy_to_be_charged.

Nice to see the String data and Powerwall Capacity data back.

image

@jasonacox
Copy link
Owner Author

Getting close to ready to release. I have tested local mode (with and without TEDAPI), cloud mode and fleetAPI mode.

How to test using Powerwall-Dashboard

First, you need to set up the host that will run your Dashboard to have a route to your Powerwall Gateway. This varies based on the OS, but will be something like this:

# Change 10.x.x.x to the address of your Powerwall on your LAN
sudo ip route add 192.168.91.0/24 via 10.x.x.x

# Note: This is a temporary route. To make it survive a reboot, you need to set it in the system
# or add it to something like /etc/rc.local 

Edit the powerwall.yml file and replace the image name for pypowerwall to jasonacox/pypowerwall:0.10.0t58-beta7
like this:

...
    pypowerwall:
        image: jasonacox/pypowerwall:0.10.0t58-beta7
        container_name: pypowerwall
        hostname: pypowerwall
        restart: unless-stopped
...

Edit pypowerwall.env and edit the IP address and add the PW_GW_PWD setting:

PW_HOST=192.168.91.1
PW_GW_PWD="GW_PASSWORD"

Apply the changes using:

./compose-dash.sh up -d

# and to tail the logs... ^C to quit
docker logs pypowerwall -f

@jasonacox
Copy link
Owner Author

Latest: jasonacox/pypowerwall:0.10.0t58-beta9

@jasonacox jasonacox merged commit 267d6c0 into main Jun 3, 2024
20 checks passed
@jasonacox jasonacox deleted the v0.10.0 branch June 3, 2024 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant