Skip to main content

API for Tesla Powerwall

None

Project description

Python tesla powerwall API

Python Tesla Powerwall API

Note: This is not an official API and as such might be incomplete and fail at any time

Usage

Setup connection

from tesla_powerwall import PowerWall

# Without authentication
power_wall = PowerWall("<ip of your powerwall>")

# With authentication
power_wall = PowerWall("<ip of your powerwall>")

# Username must be either 'installer' or 'custumer'
power_wall.login("<username>", "<email>", "<password>)

Current battery level

power_wall.charge
#=> 70.0

Sitemaster

sm = power_wall.sitemaster 
#=> <tesla_powerwall.SiteMasterResponse ...>
sm.status 
#=> StatusUp
sm.running
#=> true
sm.connected_to_tesla
#=> true

Current power supply/draw

Get current power supply/draw for home, solar, battery and grid

power_wall.battery_power
#=> -2350
power_wall.grid_power
#=> -21.449996948242188

If you want to know wether you are drawing or sending you can use is_sending_to_{battery, solar, grid} and is_drawing_from_{battery, solar, grid}.

Note: sending to solar occasionly happens at night as you can see in the documentation

Grid Status

Get current grid status. Returns one of these: GRID_STATUS_SYSTEM_GRID_UP, GRID_STATUS_SYSTEM_GRID_DOWN, GRID_STATUS_SYSTEM_GRID_RESTORED_NO_SYNC.

power_wall.grid_status
#=> "SystemGridConnected"

Powerwall Mode and backup reserve percentage

Get current mode. Returns one of these: OPERATION_MODE_SELF_CONSUMPTION, OPERATION_MODE_BACKUP, OPERATION_MODE_TIME_OF_USE, OPERATION_MODE_SCHEDULER

power_wall.mode
#=> "self_consumption"

power_wall.set_mode(tesla_powerwall.OPERATION_MODE_BACKUP)

power_wall.backup_reserve_percentage
#=> 24.6

power_wall.set_backup_reserve_percentage(tesla_powerwall.BACKUP_RESERVE_PERCENTAGE_30)

power_wall.set_mode_and_backup_reserve_percentage(tesla_powerwall.OPERATION_MODE_BACKUP, tesla_powerwall.BACKUP_RESERVE_PERCENTAGE_30)

Project details

None

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tesla_powerwall-0.1.4.tar.gz (4.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page