Sigen
Unofficial package for reading and writing data to and from Sigenergy inverters via cloud APIs.
Version 3.0.0 - Updated to support v3 app APIs for modes and smart loads.
Installation
pip install sigen
Usage
from sigen import Sigen
# username and password you use in the mySigen app.
# Region is Europe (eu) / Asia-Pacific (apac) /
# Middle East & Africa (eu) / Chinese Mainland (cn) / Unitest States (us)
sigen = Sigen(username="your_username", password="your_password", region="eu")
# Initialize the Sigen instance
await sigen.async_initialize()
# Read data
print(await sigen.fetch_station_info())
print(await sigen.get_energy_flow())
print(await sigen.get_operational_mode())
# Set default modes
print(await sigen.set_operational_mode_sigen_ai_mode())
print(await sigen.set_operational_mode_maximum_self_powered())
print(await sigen.set_operational_mode_tou())
print(await sigen.set_operational_mode_fully_fed_to_grid())
# Set custom modes (if available)
print(await sigen.set_operational_mode_summer_50kwh())
# Get and control smart loads
smart_loads = await sigen.get_smart_loads()
for load in smart_loads:
print(f"Smart Load: {load['name']} - Power: {load['valueWithUnit']}")
# Control smart loads (using path value)
print(await sigen.set_smart_load_state(1, 1)) # Turn on smart load with path 1
print(await sigen.set_smart_load_state(1, 0)) # Turn off smart load with path 1
# Or use convenient dynamic methods (generated from available smart loads)
print(await sigen.enable_smart_load_immersion()) # Turn on
print(await sigen.disable_smart_load_immersion()) # Turn off
Full example:
import logging
import os
import asyncio
from sigen import Sigen
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
async def main():
# Read username and password from environment variables
username = os.getenv('SIGEN_USERNAME')
password = os.getenv('SIGEN_PASSWORD')
if not username or not password:
logging.error("Environment variables SIGEN_USERNAME and SIGEN_PASSWORD must be set")
return
sigen = Sigen(username=username, password=password)
# Initialize the Sigen instance
await sigen.async_initialize()
# Fetch and log station info
logger.info("Fetching station info...")
station_info = await sigen.fetch_station_info()
logger.info("Station Info:")
logger.info(f"Station ID: {station_info['stationId']}")
logger.info(f"Has PV: {station_info['hasPv']}")
logger.info(f"Has EV: {station_info['hasEv']}")
logger.info(f"On Grid: {station_info['onGrid']}")
logger.info(f"PV Capacity: {station_info['pvCapacity']} kW")
logger.info(f"Battery Capacity: {station_info['batteryCapacity']} kWh")
# Fetch and log energy flow info
logger.info("\nFetching energy flow info...")
energy_flow = await sigen.get_energy_flow()
logger.info("Energy Flow Info:")
logger.info(f"PV Day Energy: {energy_flow['pvDayNrg']} kWh")
logger.info(f"PV Power: {energy_flow['pvPower']} kW")
logger.info(f"Buy/Sell Power: {energy_flow['buySellPower']} kW")
logger.info(f"EV Power: {energy_flow['evPower']} kW")
logger.info(f"AC Power: {energy_flow['acPower']} kW")
logger.info(f"Load Power: {energy_flow['loadPower']} kW")
logger.info(f"Battery Power: {energy_flow['batteryPower']} kW")
logger.info(f"Battery SOC: {energy_flow['batterySoc']}%")
# Fetch and log current operational mode
logger.info("\nFetching current operational mode...")
current_mode = await sigen.get_operational_mode()
logger.info(f"Current Operational Mode: {current_mode}")
# Change operational mode
# For default modes - using dynamic methods
# logger.info("\nSetting operational mode to 'Fully Fed to Grid'...")
# response = await sigen.set_operational_mode_fully_fed_to_grid()
# logger.info(f"Response: {response}")
# For default modes - using direct method
# logger.info("\nSetting operational mode to TOU (value=2)...")
# response = await sigen.set_operational_mode(2, -1) # -1 for default modes
# logger.info(f"Response: {response}")
# For custom modes - using dynamic methods
# logger.info("\nSetting operational mode to 'Summer 40kWh'...")
# response = await sigen.set_operational_mode_summer_40kwh()
# logger.info(f"Response: {response}")
# For custom modes - using direct method with profile ID
# logger.info("\nSetting operational mode to custom profile ID 4326...")
# response = await sigen.set_operational_mode(9, 4326) # 9 for custom modes with profile ID
# logger.info(f"Response: {response}")
# logger.info(f"Response: {response}")
# logger.info("\nFetching current operational mode...")
# current_mode = await sigen.get_operational_mode()
# logger.info(f"Current Operational Mode: {current_mode}")
if __name__ == "__main__":
asyncio.run(main())
Example output including the new features:
2025-06-25 18:25:16 INFO Fetching station info...
2025-06-25 18:25:16 INFO Station ID: 20240523012345
2025-06-25 18:25:16 INFO Has PV: True
2025-06-25 18:25:16 INFO Has EV: False
2025-06-25 18:25:16 INFO Has AC Charger: True
2025-06-25 18:25:16 INFO On Grid: True
2025-06-25 18:25:16 INFO PV Capacity: 10.3 kW
2025-06-25 18:25:16 INFO Battery Capacity: 8.06 kWh
2025-06-25 18:25:17 INFO Fetching all available operational modes...
2025-06-25 18:25:17 INFO Default Working Modes:
2025-06-25 18:25:17 INFO - Sigen AI Mode (value: 1)
2025-06-25 18:25:17 INFO - Maximum Self-Powered (value: 0)
2025-06-25 18:25:17 INFO - TOU (value: 2)
2025-06-25 18:25:17 INFO - Fully Fed to Grid (value: 5)
2025-06-25 18:25:17 INFO - Remote EMS Mode (value: 7)
2025-06-25 18:25:17 INFO Custom Energy Profile Items:
2025-06-25 18:25:17 INFO - Summer 50kWh (profileId: 3126, value: 9)
2025-06-25 18:25:17 INFO - Storm Ready (profileId: 3939, value: 9)
2025-06-25 18:25:17 INFO - Summer 40kWh (profileId: 4326, value: 9)
2025-06-25 18:25:17 INFO - Summer 30kWh (profileId: 4328, value: 9)
2025-06-25 18:25:17 INFO Current Operational Mode: TOU
2025-06-25 18:25:19 INFO --------- Smart Loads Functionality ---------
2025-06-25 18:25:19 INFO Fetching smart loads...
2025-06-25 18:25:19 INFO Found 1 smart loads:
2025-06-25 18:25:19 INFO - Name: Immersion
2025-06-25 18:25:19 INFO Path: 1
2025-06-25 18:25:19 INFO Power: 0.00 kW
2025-06-25 18:25:19 INFO Current state: ON
2025-06-25 18:25:19 INFO Enable method: sigen.enable_smart_load_immersion()
2025-06-25 18:25:19 INFO Disable method: sigen.disable_smart_load_immersion()
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sigen-3.0.3.tar.gz
(13.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
sigen-3.0.3-py3-none-any.whl
(11.1 kB
view details)
File details
Details for the file sigen-3.0.3.tar.gz.
File metadata
- Download URL: sigen-3.0.3.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b746127a0681f2b1997706cd9ccbeb1c43ebd9453b54af5b0626ed0d80774851
|
|
| MD5 |
d50339964345438e27c8a1b99a461968
|
|
| BLAKE2b-256 |
37dd692f5cef4a828181fb884a970e4efcd2ecd1073c502380cb1a9f7f0bd83d
|
File details
Details for the file sigen-3.0.3-py3-none-any.whl.
File metadata
- Download URL: sigen-3.0.3-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f614fd89a94679509bb0bca285214088fbccaf19eb803135e70b2b3c0fda23fd
|
|
| MD5 |
6111a2e1d643accfd6f8f347a6833f4f
|
|
| BLAKE2b-256 |
02bbd60e27ca80997bc9362be0e7f5e40c1fa87edf391da3020f64e069750e59
|