powervaultpy 0.0.7__tar.gz → 0.0.9__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.
- {powervaultpy-0.0.7 → powervaultpy-0.0.9}/PKG-INFO +10 -1
- {powervaultpy-0.0.7 → powervaultpy-0.0.9}/pyproject.toml +2 -2
- {powervaultpy-0.0.7 → powervaultpy-0.0.9}/src/powervaultpy/powervault.py +27 -3
- {powervaultpy-0.0.7 → powervaultpy-0.0.9}/src/powervaultpy.egg-info/PKG-INFO +10 -1
- {powervaultpy-0.0.7 → powervaultpy-0.0.9}/setup.cfg +0 -0
- {powervaultpy-0.0.7 → powervaultpy-0.0.9}/src/powervaultpy/__init__.py +0 -0
- {powervaultpy-0.0.7 → powervaultpy-0.0.9}/src/powervaultpy.egg-info/SOURCES.txt +0 -0
- {powervaultpy-0.0.7 → powervaultpy-0.0.9}/src/powervaultpy.egg-info/dependency_links.txt +0 -0
- {powervaultpy-0.0.7 → powervaultpy-0.0.9}/src/powervaultpy.egg-info/requires.txt +0 -0
- {powervaultpy-0.0.7 → powervaultpy-0.0.9}/src/powervaultpy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: powervaultpy
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.9
|
4
4
|
Summary: An integration to control the Powervault battery
|
5
5
|
Author-email: Adam McDonagh <adam@elitemonkey.net>
|
6
6
|
License: GPLv3
|
@@ -13,4 +13,13 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
13
13
|
Classifier: Operating System :: POSIX
|
14
14
|
Requires-Python: >=3.9
|
15
15
|
Description-Content-Type: text/markdown
|
16
|
+
Requires-Dist: requests>=2.28
|
17
|
+
Requires-Dist: pytz
|
16
18
|
Provides-Extra: dev
|
19
|
+
Requires-Dist: black>=23.1.0; extra == "dev"
|
20
|
+
Requires-Dist: isort; extra == "dev"
|
21
|
+
Requires-Dist: pytest; extra == "dev"
|
22
|
+
Requires-Dist: pytest-env; extra == "dev"
|
23
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
24
|
+
Requires-Dist: bumpver; extra == "dev"
|
25
|
+
Requires-Dist: pre-commit; extra == "dev"
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "powervaultpy"
|
7
|
-
version = "0.0.
|
7
|
+
version = "0.0.9"
|
8
8
|
authors = [
|
9
9
|
{ name="Adam McDonagh", email="adam@elitemonkey.net" },
|
10
10
|
]
|
@@ -43,7 +43,7 @@ dev = [
|
|
43
43
|
profile = 'black'
|
44
44
|
|
45
45
|
[tool.bumpver]
|
46
|
-
current_version = "0.
|
46
|
+
current_version = "0.0.9"
|
47
47
|
version_pattern = "MAJOR.MINOR.PATCH"
|
48
48
|
commit_message = "bump version {old_version} -> {new_version}"
|
49
49
|
commit = true
|
@@ -18,7 +18,7 @@ VALID_STATUSES = [
|
|
18
18
|
]
|
19
19
|
|
20
20
|
_LOGGER = logging.getLogger(__name__)
|
21
|
-
_LOGGER.setLevel(logging.
|
21
|
+
_LOGGER.setLevel(logging.INFO)
|
22
22
|
|
23
23
|
class PowerVaultApiClientError(Exception):
|
24
24
|
"""Exception to indicate a general API error."""
|
@@ -144,6 +144,30 @@ class PowerVault:
|
|
144
144
|
|
145
145
|
_LOGGER.error("Failed to retrieve data")
|
146
146
|
|
147
|
+
def get_kwh(self, data: dict) -> dict:
|
148
|
+
# List of attributes to retrieve from data dict
|
149
|
+
attributes = [
|
150
|
+
"batteryInputFromGrid",
|
151
|
+
"batteryInputFromSolar",
|
152
|
+
"batteryOutputConsumedByHome",
|
153
|
+
"batteryOutputExported",
|
154
|
+
"homeConsumed",
|
155
|
+
"gridConsumedByHome",
|
156
|
+
"solarConsumedByHome",
|
157
|
+
"solarExported",
|
158
|
+
"solarGenerated",
|
159
|
+
]
|
160
|
+
# For each attribute, loop through the data dict and conver the W reading to kWh over the 5 minute period
|
161
|
+
totals = {}
|
162
|
+
for row in data:
|
163
|
+
for attribute in attributes:
|
164
|
+
if attribute in row:
|
165
|
+
if attribute not in totals:
|
166
|
+
totals[attribute] = 0
|
167
|
+
totals[attribute] += round(row[attribute] / 1000 * (5/60), 2)
|
168
|
+
|
169
|
+
return totals
|
170
|
+
|
147
171
|
def set_battery_state(self, unit_id: str, battery_state) -> bool:
|
148
172
|
"""Override the current battery status with the provided one."""
|
149
173
|
url = f"{self._base_url}/unit/{unit_id}/stateOverride"
|
@@ -165,14 +189,14 @@ class PowerVault:
|
|
165
189
|
|
166
190
|
state_override_response = self._read_response(
|
167
191
|
self._session.post(url, json=payload), url)
|
168
|
-
|
192
|
+
|
169
193
|
_LOGGER.debug("State Override: %s", state_override_response)
|
170
194
|
|
171
195
|
if (state_override_response is not None) and ("stateOverrides" in state_override_response) and "message" in state_override_response and state_override_response["message"] == "success":
|
172
196
|
return True
|
173
197
|
else:
|
174
198
|
return False
|
175
|
-
|
199
|
+
|
176
200
|
|
177
201
|
def get_battery_state(self, unit_id: str) -> any:
|
178
202
|
"""Query the schedule and overrides to determine the current battery state."""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: powervaultpy
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.9
|
4
4
|
Summary: An integration to control the Powervault battery
|
5
5
|
Author-email: Adam McDonagh <adam@elitemonkey.net>
|
6
6
|
License: GPLv3
|
@@ -13,4 +13,13 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
13
13
|
Classifier: Operating System :: POSIX
|
14
14
|
Requires-Python: >=3.9
|
15
15
|
Description-Content-Type: text/markdown
|
16
|
+
Requires-Dist: requests>=2.28
|
17
|
+
Requires-Dist: pytz
|
16
18
|
Provides-Extra: dev
|
19
|
+
Requires-Dist: black>=23.1.0; extra == "dev"
|
20
|
+
Requires-Dist: isort; extra == "dev"
|
21
|
+
Requires-Dist: pytest; extra == "dev"
|
22
|
+
Requires-Dist: pytest-env; extra == "dev"
|
23
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
24
|
+
Requires-Dist: bumpver; extra == "dev"
|
25
|
+
Requires-Dist: pre-commit; extra == "dev"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|