Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion growattServer/base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def plant_list(self, user_id: str) -> dict[str, Any]:
allow_redirects=False
)

return response.json().get("back", [])
return response.json().get("back", {})

def plant_detail(self, plant_id: str, timespan: Timespan, date: datetime.datetime | None = None) -> dict[str, Any]:
"""
Expand Down
20 changes: 10 additions & 10 deletions growattServer/open_api_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ def plant_list(self) -> dict[str, Any]: # type: ignore[override]

return self.process_response(response.json(), "getting plant list")

def plant_details(self, plant_id: int) -> dict[str, Any]:
def plant_details(self, plant_id: str) -> dict[str, Any]:
"""
Get basic information about a power station.

Args:
plant_id (int): Power Station ID
plant_id (str): Power Station ID

Returns:
dict: A dictionary containing the plant details.
Expand All @@ -147,12 +147,12 @@ def plant_details(self, plant_id: int) -> dict[str, Any]:

return self.process_response(response.json(), "getting plant details")

def plant_energy_overview(self, plant_id: int) -> dict[str, Any]:
def plant_energy_overview(self, plant_id: str) -> dict[str, Any]:
"""
Get an overview of a plant's energy data.

Args:
plant_id (int): Power Station ID
plant_id (str): Power Station ID

Returns:
dict: A dictionary containing the plant energy overview.
Expand All @@ -175,15 +175,15 @@ def plant_energy_overview(self, plant_id: int) -> dict[str, Any]:
return self.process_response(response.json(), "getting plant energy overview")

def plant_power_overview(
self, plant_id: int, day: str | date | None = None
self, plant_id: str, day: str | date | None = None
) -> dict:
"""
Obtain power data of a certain power station.

Get the frequency once every 5 minutes

Args:
plant_id (int): Power Station ID
plant_id (str): Power Station ID
day (date): Date - defaults to today in the local system timezone

Returns:
Expand Down Expand Up @@ -224,7 +224,7 @@ def plant_power_overview(

def plant_energy_history(
self,
plant_id: int,
plant_id: str,
start_date: date | None = None,
end_date: date | None = None,
time_unit: str = "day",
Expand All @@ -235,7 +235,7 @@ def plant_energy_history(
Retrieve plant energy data for multiple days/months/years.

Args:
plant_id (int): Power Station ID
plant_id (str): Power Station ID
start_date (date, optional): Start Date - defaults to today in the local system timezone
end_date (date, optional): End Date - defaults to today in the local system timezone
time_unit (str, optional): Time unit ('day', 'month', 'year') - defaults to 'day'
Expand Down Expand Up @@ -308,7 +308,7 @@ def plant_energy_history(

return self.process_response(response.json(), "getting plant energy history")

def device_list(self, plant_id: int) -> dict[str, Any]: # type: ignore[override]
def device_list(self, plant_id: str) -> dict[str, Any]: # type: ignore[override]
"""
Get devices associated with plant.

Expand All @@ -326,7 +326,7 @@ def device_list(self, plant_id: int) -> dict[str, Any]: # type: ignore[override
10: pbd

Args:
plant_id (int): Power Station ID
plant_id (str): Power Station ID

Returns:
DeviceList
Expand Down
Loading