Skip to main content

Python API client for Tesla Connect Pakistan geyser and inverter devices

Project description

pyteslaconnectpk

PyPI License

Python API client for Tesla Connect Pakistan geyser and inverter devices.

Disclaimer: This is an unofficial, community-built library. The author has no affiliation with Tesla Industries Pakistan (https://tesla-pv.com). All product names, logos, and brands are property of their respective owners.

Installation

pip install pyteslaconnectpk

Quick Start

from pyteslaconnectpk import TeslaConnectApi

client = TeslaConnectApi("03XXXXXXXXX", "your_password")
client.sign_in()

print(f"Logged in as {client.user_name}")
print(f"Devices: {len(client.devices)}")

# Get geyser details
for device in client.devices:
    if device["type_id"] == 2:  # Geyser
        details = client.get_geyser_details(device["device_id"])
        print(f"Temperature: {details['curr_temp']}°C")

# Control the geyser
client.set_geyser_temp_limit("device_id", 55)
client.set_geyser_boost("device_id", True)

API Reference

Authentication

Method Description
sign_in() Authenticate and obtain a session token
change_password(new_password) Change the account password

Devices

Method Description
refresh_devices() Re-login to refresh the device list
add_device(device_id, name) Register a new device
delete_device(device_id, name) Remove a device

Geyser

Method Description
get_geyser_details(device_id) Get geyser status (temp, mode, timers, etc.)
set_geyser_boost(device_id, enabled) Toggle boost mode
set_geyser_mode(device_id, curr_mode, user_mode) Set operating mode
set_geyser_temp_limit(device_id, temp_limit) Set target temperature
set_geyser_timer(device_id, times) Set hourly schedule
set_geyser_two_hour_mode(device_id, enabled) Toggle two-hour mode
set_geyser_vacation_mode(device_id, enabled) Toggle vacation mode

Inverter

Method Description
get_inverter_details(device_id) Get inverter status

Constants

Constant Value Description
DEVICE_TYPE_GEYSER 2 Geyser device type
DEVICE_TYPE_INVERTER 1 Inverter device type
GEYSER_MODE_GAS 0 Gas mode
GEYSER_MODE_ELECTRICITY 1 Electric mode
GEYSER_MODE_AUTOMATIC 2 Automatic mode
GEYSER_MODE_SOLAR_ENABLED 3 Solar enabled
GEYSER_MODE_SOLAR_DISABLED 4 Solar disabled

Exceptions

Exception When
TeslaConnectAuthError Invalid credentials or expired session
TeslaConnectApiError Connection failure, timeout, or HTTP error

Used By

License

MIT

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

pyteslaconnectpk-3.0.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyteslaconnectpk-3.0.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file pyteslaconnectpk-3.0.0.tar.gz.

File metadata

  • Download URL: pyteslaconnectpk-3.0.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pyteslaconnectpk-3.0.0.tar.gz
Algorithm Hash digest
SHA256 222d405da0bf3f687186fd1c5f351ba122ef1d701a829a619662c50ae33b5b20
MD5 36f10f7e782904f45ed48de74927c89f
BLAKE2b-256 74a2b1e9bb49cb8e3d727d32aa98e4883a17ca1e32fb0f8befec395b173843bd

See more details on using hashes here.

File details

Details for the file pyteslaconnectpk-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyteslaconnectpk-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89aa7e969829ebf9e941674aee3d57199254c49585d435c4fc5fe53fe19e22e4
MD5 8ff511da2115a0063e22881706ee14d1
BLAKE2b-256 b6bcbe4b83385e73836a3e8693ba77d3015fb983ebee7467a2469cb3754faf93

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