powervaultpy 0.0.9__tar.gz → 1.0.0__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.9 → powervaultpy-1.0.0}/PKG-INFO +1 -1
- {powervaultpy-0.0.9 → powervaultpy-1.0.0}/pyproject.toml +2 -2
- {powervaultpy-0.0.9 → powervaultpy-1.0.0}/src/powervaultpy/powervault.py +12 -7
- {powervaultpy-0.0.9 → powervaultpy-1.0.0}/src/powervaultpy.egg-info/PKG-INFO +1 -1
- {powervaultpy-0.0.9 → powervaultpy-1.0.0}/setup.cfg +0 -0
- {powervaultpy-0.0.9 → powervaultpy-1.0.0}/src/powervaultpy/__init__.py +0 -0
- {powervaultpy-0.0.9 → powervaultpy-1.0.0}/src/powervaultpy.egg-info/SOURCES.txt +0 -0
- {powervaultpy-0.0.9 → powervaultpy-1.0.0}/src/powervaultpy.egg-info/dependency_links.txt +0 -0
- {powervaultpy-0.0.9 → powervaultpy-1.0.0}/src/powervaultpy.egg-info/requires.txt +0 -0
- {powervaultpy-0.0.9 → powervaultpy-1.0.0}/src/powervaultpy.egg-info/top_level.txt +0 -0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "powervaultpy"
|
7
|
-
version = "0.0
|
7
|
+
version = "1.0.0"
|
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.0
|
46
|
+
current_version = "1.0.0"
|
47
47
|
version_pattern = "MAJOR.MINOR.PATCH"
|
48
48
|
commit_message = "bump version {old_version} -> {new_version}"
|
49
49
|
commit = true
|
@@ -113,14 +113,12 @@ class PowerVault:
|
|
113
113
|
_LOGGER.error("Failed to retrieve account")
|
114
114
|
|
115
115
|
def get_data(
|
116
|
-
self, unit_id: str,
|
116
|
+
self, unit_id: str, period: str = None
|
117
117
|
) -> any:
|
118
118
|
"""Get the latest metrics from the unit."""
|
119
119
|
url = f"{self._base_url}/unit/{unit_id}/data"
|
120
120
|
|
121
|
-
if
|
122
|
-
url = f"{url}?from={from_}&to={to}"
|
123
|
-
elif period is not None:
|
121
|
+
if period is not None:
|
124
122
|
if period not in [
|
125
123
|
"today",
|
126
124
|
"yesterday",
|
@@ -134,6 +132,12 @@ class PowerVault:
|
|
134
132
|
"last-month",
|
135
133
|
]:
|
136
134
|
raise Exception(f"Invalid period: {period}")
|
135
|
+
|
136
|
+
if not period:
|
137
|
+
# If period is not set, set it to anything,
|
138
|
+
# because for some reason if you leave it blank you get nulls most of the time
|
139
|
+
period = "past_hour" # This is not a valid period, but it gets you the last live values regardless
|
140
|
+
|
137
141
|
url = f"{url}?period={period}"
|
138
142
|
|
139
143
|
data_response = self._read_response(self._session.get(url), url)
|
@@ -162,10 +166,11 @@ class PowerVault:
|
|
162
166
|
for row in data:
|
163
167
|
for attribute in attributes:
|
164
168
|
if attribute in row:
|
165
|
-
if attribute not in totals:
|
169
|
+
if attribute not in totals or not totals[attribute]:
|
166
170
|
totals[attribute] = 0
|
167
|
-
|
168
|
-
|
171
|
+
value = row[attribute]
|
172
|
+
if value:
|
173
|
+
totals[attribute] += round(value / 1000 * (5/60), 2)
|
169
174
|
return totals
|
170
175
|
|
171
176
|
def set_battery_state(self, unit_id: str, battery_state) -> bool:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|