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-1.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

pyteslaconnectpk-1.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyteslaconnectpk-1.1.0.tar.gz
Algorithm Hash digest
SHA256 accbfc72107e15b6ddc0010edcf72e8f375fbc024b55994cf2b66751355c1007
MD5 40e3ff916992a24f7c486be84b750d3d
BLAKE2b-256 8891c6f970fad1eebd235337cff86cb89c62395efddd75481f12954a9f79292d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyteslaconnectpk-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec54d970b777f54e5c853e31e0c45dad08161c8c5e7d0b9c0f715a50bdb85b0b
MD5 764619486d22ffbe28ba3db3010bef37
BLAKE2b-256 42ceb2f3b949e7870a8e1d7ed770bced15f38c677eff04090051edecf41e2f91

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