jgriss / FusionSolarPy

A basic client to the Huawei Fusion Solar cloud interface for solar power plants
MIT License
30 stars 12 forks source link

Login failed: Invalid redirected host. #12

Closed PawarutK closed 10 months ago

PawarutK commented 1 year ago

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 the

URL 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)

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."""
VGerris commented 1 year ago

same for me using eu5 as domain

VGerris commented 1 year ago

this was actually resolved by using region03eu5 , so perhaps just the wrong domain. if it solves your issue, please close it, thank you!