forked from jasonacox/pypowerwall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
28 lines (21 loc) · 910 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Example test for pypowerwall
import pypowerwall
# Optional: Turn on Debug Mode
pypowerwall.set_debug(True)
# Credentials for your Powerwall - Customer Login Data
password='password'
email='[email protected]'
host = "localhost" # Change to the IP of your Powerwall
timezone = "America/Los_Angeles" # Change to your local timezone/tz
# Connect to Powerwall
pw = pypowerwall.Powerwall(host,password,email,timezone)
# Display Metric Examples
print("Battery power level: %0.0f%%" % pw.level())
print("Power response: %r" % pw.power())
print("Grid Power: %0.2fkW" % (float(pw.grid())/1000.0))
print("Solar Power: %0.2fkW" % (float(pw.solar())/1000.0))
print("Battery Power: %0.2fkW" % (float(pw.battery())/1000.0))
print("Home Power: %0.2fkW" % (float(pw.home())/1000.0))
# Raw JSON Data Examples
print("Grid raw: %r" % pw.grid(verbose=True))
print("Solar raw: %r" % pw.solar(verbose=True))