Skip to main content

A package to reading and writing data to and from Sigenergy inverters

Project description

Sigen

A package to reading and writing data to and from Sigenergy inverters.

Installation

pip install sigen

Usage

import logging
import coloredlogs
import os
from src.sigen import Sigen


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

    # Initialize logging
    coloredlogs.install(level='INFO')
    sigen = Sigen(username=username, password=password)

    # Fetch and log station info
    logging.info("Fetching station info...")
    station_info = sigen.get_station_info()
    logging.info("Station Info:")
    logging.info(f"Station ID: {station_info['stationId']}")
    logging.info(f"Has PV: {station_info['hasPv']}")
    logging.info(f"Has EV: {station_info['hasEv']}")
    logging.info(f"On Grid: {station_info['onGrid']}")
    logging.info(f"PV Capacity: {station_info['pvCapacity']} kW")
    logging.info(f"Battery Capacity: {station_info['batteryCapacity']} kWh")

    # Fetch and log energy flow info
    logging.info("\nFetching energy flow info...")
    energy_flow = sigen.get_energy_flow()
    logging.info("Energy Flow Info:")
    logging.info(f"PV Day Energy: {energy_flow['pvDayNrg']} kWh")
    logging.info(f"PV Power: {energy_flow['pvPower']} kW")
    logging.info(f"Buy/Sell Power: {energy_flow['buySellPower']} kW")
    logging.info(f"EV Power: {energy_flow['evPower']} kW")
    logging.info(f"AC Power: {energy_flow['acPower']} kW")
    logging.info(f"Load Power: {energy_flow['loadPower']} kW")
    logging.info(f"Battery Power: {energy_flow['batteryPower']} kW")
    logging.info(f"Battery SOC: {energy_flow['batterySoc']}%")

    # Fetch and log current operational mode
    logging.info("\nFetching current operational mode...")
    current_mode = sigen.get_operational_mode()
    logging.info(f"Current Operational Mode: {current_mode}")

    # Change operational mode (example: setting mode to 'Fully Fed to Grid')
    logging.info("\nSetting operational mode to 'Fully Fed to Grid'...")
    response = sigen.set_operational_mode(5)
    logging.info(f"Response: {response}")

    logging.info("\nFetching current operational mode...")
    current_mode = sigen.get_operational_mode()
    logging.info(f"Current Operational Mode: {current_mode}")


if __name__ == "__main__":
    main()

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

sigen-0.0.6.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

sigen-0.0.6-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file sigen-0.0.6.tar.gz.

File metadata

  • Download URL: sigen-0.0.6.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for sigen-0.0.6.tar.gz
Algorithm Hash digest
SHA256 f32e5e3dedcfca5d2fdaf5dff9a64d0f4058ed73a5fd394c42869225b1903d41
MD5 0f1e378f00c3261bc72387ab05085348
BLAKE2b-256 d88c49c6fed7d6d8070802cea321851e88ae1fb4ddf2c4d155601e152db1643e

See more details on using hashes here.

File details

Details for the file sigen-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: sigen-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for sigen-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ddb21d828582581500111c338345e0db3108196e8786dc0134e01f8f6647a770
MD5 be1c93fc41146957eb35d827541508aa
BLAKE2b-256 dd0339464ed0182e13a4bc208837fb0de65e88a1bedf2b03729c792b5ead923a

See more details on using hashes here.

Supported by

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