Skip to main content

API for Tesla Powerwall

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


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 details)

Uploaded Source

File details

Details for the file tesla_powerwall-0.1.4.tar.gz.

File metadata

  • Download URL: tesla_powerwall-0.1.4.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for tesla_powerwall-0.1.4.tar.gz
Algorithm Hash digest
SHA256 8f2ff7647af2be514e9d875c7df49e634adf7138f6bae56137735b7d14a729a7
MD5 f072b4026637b61c4f082b15f3ca926d
BLAKE2b-256 0d36fd4384637288075bea9d7290eb289b379bcf329761f8a3ec30d2c6ded649

See more details on using hashes here.

Supported by

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