Skip to content
Merged
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
8 changes: 4 additions & 4 deletions growattServer/base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ def login(self, username: str, password: str, is_password_hashed: bool = False)
})
return data

def plant_list(self, user_id: str) -> list[dict[str, Any]]:
def plant_list(self, user_id: str) -> dict[str, Any]:
"""
Get a list of plants connected to this account.

Args:
user_id (str): The ID of the user.

Returns:
list: A list of plants connected to the account.
dict: A dictionary containing 'data' (list of plants) and 'totalData' keys.

Raises:
Exception: If the request to the server fails.
Expand Down Expand Up @@ -868,14 +868,14 @@ def inverter_list(self, plant_id: str) -> list[dict[str, Any]]:
"This function may be deprecated in the future because naming is not correct, use device_list instead", DeprecationWarning, stacklevel=2)
return self.device_list(plant_id)

def __get_all_devices(self, plant_id: str) -> dict[str, Any]:
def __get_all_devices(self, plant_id: str) -> list[dict[str, Any]]:
"""Get basic plant information with device list."""
response = self.session.get(self.get_url("newTwoPlantAPI.do"),
params={"op": "getAllDeviceList",
"plantId": plant_id,
"language": 1})

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

def device_list(self, plant_id: str) -> list[dict[str, Any]]:
"""Get a list of all devices connected to plant."""
Expand Down
Loading