Skip to main content

A simply API to the Huawei Fusion Solar web interface.

Project description

FusionSolarPy

A very basic python client for the HuaweiFusionSolar API used to monitor solar power plants.

This client uses the https://region01eu5.fusionsolar.huawei.com end point by default. It is possible to change this using the huawei_subdomain parameter. But this has not been tested on any other end-points.

Please report any bugs!

Installation

Simply install from pypi using:

pip install fusion_solar_py

Usage

The basic usage centers around the FusionSolarClient class. It currently only has one method to extract the current power production, the total power production for the current day, and the total energy ever produced by the plant.

from fusion_solar_py.client import FusionSolarClient

# log into the API - with proper credentials...
client = FusionSolarClient("my_user", "my_password")

# NOTE: Depending on your region, you may need to set the
# `huawei_subdomain` parameter. This is the first part of the
# URL when you enter the FusionSolar API through your webbrowser
#
# client = FusionSolarClient("my_user", "my_password", huawei_subdomai="region01eu5")

# get the stats
stats = client.get_power_status()

# print all stats
print(f"Current power: {stats.current_power_kw} kW")
print(f"Total power today: {stats.total_power_today_kwh} kWh")
print(f"Total power: {stats.total_power_kwh} kWh")

# log out - just in case
client.log_out()

It is additional possible to retrieve the data for specific plants - in case multiple plants are available through the account.

from fusion_solar_py.client import FusionSolarClient

# log into the API - with proper credentials...
client = FusionSolarClient("my_user", "my_password")

# get the plant ids
plant_ids = client.get_plant_ids()

print(f"Found {len(plant_ids)} plants")

# get the data for the first plant
plant_data = client.get_plant_stats(plant_ids[0])

# plant_data is a dict that contains the complete
# usage statistics of the current day. There is
# a helper function available to extract some
# most recent measurements
last_values = client.get_last_plant_data(plant_data)

print(f"Last production at {last_values['productPower']['time']]}: {last_values['productPower']['value']}")

# In case you have a battery installed
print(f"Last battery charge at {last_values['chargePower']['time']}: {last_values['chargePower']['value']}")

# log out - just in case
client.log_out()

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

fusion_solar_py-0.0.6.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

fusion_solar_py-0.0.6-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fusion_solar_py-0.0.6.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for fusion_solar_py-0.0.6.tar.gz
Algorithm Hash digest
SHA256 ad4914d9c6e6dc1e6fcddaab87eed199140dd719ab133dac867ac6a982d4fa86
MD5 20418a9e79e1dc40ea912e968b6fb13d
BLAKE2b-256 baeed9e2a658e960b289fa0499e2b76b7a553e55b6cea0b049fa9815db7558c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fusion_solar_py-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b8d362ce799d8c3a3a569546d99cbeae78278002544e34ae217a4097b3b6df27
MD5 fd85d728ab15b46a4e669d77a6267899
BLAKE2b-256 c576dedef52e3e96640c85c6cac60f29a8a631cc81b9acc4026c0c74ab16eee4

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