pysolarcloud 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: pysolarcloud
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A library to interact with Sungrow's iSolarCloud API
5
5
  Author-email: Tore Green <bugjam@e-dreams.dk>
6
6
  License: MIT
@@ -17,6 +17,7 @@ Requires-Dist: aiohttp
17
17
  Provides-Extra: dev
18
18
  Requires-Dist: pytest; extra == "dev"
19
19
  Requires-Dist: pytest-asyncio; extra == "dev"
20
+ Dynamic: license-file
20
21
  Dynamic: provides-extra
21
22
  Dynamic: requires-dist
22
23
  Dynamic: requires-python
@@ -30,6 +31,7 @@ The current version has only very basic functionality:
30
31
  * Getting a list plants
31
32
  * Getting details of a plant
32
33
  * Getting "real-time" data of a plant (Data is updated every 5 minutes according to Sungrow's documentation)
34
+ * Getting historical data
33
35
 
34
36
  ## Quirks
35
37
  The iSolarCloud API is quite new and not very mature. Some tips:
@@ -7,6 +7,7 @@ The current version has only very basic functionality:
7
7
  * Getting a list plants
8
8
  * Getting details of a plant
9
9
  * Getting "real-time" data of a plant (Data is updated every 5 minutes according to Sungrow's documentation)
10
+ * Getting historical data
10
11
 
11
12
  ## Quirks
12
13
  The iSolarCloud API is quite new and not very mature. Some tips:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pysolarcloud"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  authors = [
5
5
  { name="Tore Green", email="bugjam@e-dreams.dk" },
6
6
  ]
@@ -4,6 +4,7 @@ from abc import ABC, abstractmethod
4
4
  from enum import StrEnum
5
5
  import logging
6
6
  import time
7
+ from urllib.parse import quote_plus
7
8
 
8
9
  from aiohttp import ClientResponse, ClientSession
9
10
 
@@ -35,14 +36,18 @@ class AbstractAuth(ABC):
35
36
  """Return the URL to authorize the user."""
36
37
  match self.host:
37
38
  case Server.China.value:
39
+ auth_server = "web3.isolarcloud.com"
38
40
  cloud_id = 1
39
41
  case Server.International.value:
42
+ auth_server = "web3.isolarcloud.com.hk"
40
43
  cloud_id = 2
41
44
  case Server.Europe.value:
45
+ auth_server = "web3.isolarcloud.eu"
42
46
  cloud_id = 3
43
47
  case Server.Australia.value:
44
- cloud_id = 4
45
- return f"https://web3.isolarcloud.eu/#/authorized-app?cloudId={cloud_id}&applicationId={self.app_id}&redirectUrl={redirect_uri}"
48
+ auth_server = "auweb3.isolarcloud.com"
49
+ cloud_id = 7
50
+ return f"https://{auth_server}/#/authorized-app?cloudId={cloud_id}&applicationId={self.app_id}&redirectUrl={quote_plus(redirect_uri)}"
46
51
 
47
52
  @abstractmethod
48
53
  async def async_get_access_token(self) -> str:
@@ -137,12 +137,14 @@ class Plants:
137
137
  series = []
138
138
  for frame in plant:
139
139
  data = {}
140
+ ts = datetime.strptime(frame["time_stamp"], TS_FORMAT)
140
141
  for k,v in frame.items():
141
142
  if k == "time_stamp":
142
- data["timestamp"] = datetime.strptime(v, TS_FORMAT)
143
+ continue
143
144
  else:
144
- data |= self._format_measure_point(k[1:], v, point_dict)
145
- series.append(data)
145
+ data = self._format_measure_point(k[1:], v, point_dict)
146
+ data["timestamp"] = ts
147
+ series.append(data)
146
148
  plants[str(plant_id)] = series
147
149
  _LOGGER.debug("async_get_historical_data: %s", plants)
148
150
  return plants
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: pysolarcloud
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A library to interact with Sungrow's iSolarCloud API
5
5
  Author-email: Tore Green <bugjam@e-dreams.dk>
6
6
  License: MIT
@@ -17,6 +17,7 @@ Requires-Dist: aiohttp
17
17
  Provides-Extra: dev
18
18
  Requires-Dist: pytest; extra == "dev"
19
19
  Requires-Dist: pytest-asyncio; extra == "dev"
20
+ Dynamic: license-file
20
21
  Dynamic: provides-extra
21
22
  Dynamic: requires-dist
22
23
  Dynamic: requires-python
@@ -30,6 +31,7 @@ The current version has only very basic functionality:
30
31
  * Getting a list plants
31
32
  * Getting details of a plant
32
33
  * Getting "real-time" data of a plant (Data is updated every 5 minutes according to Sungrow's documentation)
34
+ * Getting historical data
33
35
 
34
36
  ## Quirks
35
37
  The iSolarCloud API is quite new and not very mature. Some tips:
File without changes
File without changes
File without changes
File without changes