in
2
3 # log into the API - with proper credentials...
----> 4 client = FusionSolarClient("user", "pass", huawei_subdomain="intl")
5
6 # NOTE: Depending on your region, you may need to set the
c:\users\pawarutk\appdata\local\programs\python\python38\lib\site-packages\fusion_solar_py\client.py in __init__(self, username, password, huawei_subdomain)
80
81 # login immediately to ensure that the credentials are correct
---> 82 self._login()
83
84 def log_out(self):
c:\users\pawarutk\appdata\local\programs\python\python38\lib\site-packages\fusion_solar_py\client.py in _login(self)
122 if r.json()["errorCode"]:
123 _LOGGER.error(f"Login failed: {r.json()['errorMsg']}")
--> 124 raise AuthenticationException(
125 f"Failed to login into FusionSolarAPI: { r.json()['errorMsg'] }"
126 )
AuthenticationException: Failed to login into FusionSolarAPI: Invalid redirected host."""
Input Code : from fusion_solar_py.client import FusionSolarClient
log into the API - with proper credentials...
client = FusionSolarClient("user", "pass", huawei_subdomain="intl")
NOTE: Depending on your region, you may need to set the
huawei_subdomain
parameter. This is the first part of theURL when you enter the FusionSolar API through your webbrowser
#
client = FusionSolarClient("my_user", "my_password", huawei_subdomain="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()
"""
Output Code :
AuthenticationException Traceback (most recent call last)