pyteslaconnectpk
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
- tesla-pakistan-hacs — Home Assistant custom integration
License
MIT
Metadata
Release files for pyteslaconnectpk 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyteslaconnectpk-3.0.0.tar.gz | 12.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyteslaconnectpk-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.9 kB
Release files / pyteslaconnectpk-3.0.0.tar.gz
| Download URL | pyteslaconnectpk-3.0.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
222d405da0bf3f687186fd1c5f351ba122ef1d701a829a619662c50ae33b5b20
|
|
BLAKE2b-256 checksum How to use checksums |
74a2b1e9bb49cb8e3d727d32aa98e4883a17ca1e32fb0f8befec395b173843bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / pyteslaconnectpk-3.0.0-py3-none-any.whl
| Download URL | pyteslaconnectpk-3.0.0-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89aa7e969829ebf9e941674aee3d57199254c49585d435c4fc5fe53fe19e22e4
|
|
BLAKE2b-256 checksum How to use checksums |
b6bcbe4b83385e73836a3e8693ba77d3015fb983ebee7467a2469cb3754faf93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|