python-openevse-http 0.2.4__tar.gz → 0.2.5__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.
Files changed (20) hide show
  1. {python_openevse_http-0.2.4/python_openevse_http.egg-info → python_openevse_http-0.2.5}/PKG-INFO +1 -1
  2. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/openevsehttp/__main__.py +14 -0
  3. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5/python_openevse_http.egg-info}/PKG-INFO +1 -1
  4. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/setup.py +1 -1
  5. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/tests/test_external_session.py +1 -2
  6. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/tests/test_main.py +32 -1
  7. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/LICENSE +0 -0
  8. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/README.md +0 -0
  9. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/openevsehttp/__init__.py +0 -0
  10. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/openevsehttp/const.py +0 -0
  11. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/openevsehttp/exceptions.py +0 -0
  12. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/openevsehttp/websocket.py +0 -0
  13. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/python_openevse_http.egg-info/SOURCES.txt +0 -0
  14. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/python_openevse_http.egg-info/dependency_links.txt +0 -0
  15. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/python_openevse_http.egg-info/not-zip-safe +0 -0
  16. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/python_openevse_http.egg-info/requires.txt +0 -0
  17. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/python_openevse_http.egg-info/top_level.txt +0 -0
  18. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/setup.cfg +0 -0
  19. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/tests/test_main_edge_cases.py +0 -0
  20. {python_openevse_http-0.2.4 → python_openevse_http-0.2.5}/tests/test_websocket.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python_openevse_http
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Python wrapper for OpenEVSE HTTP API
5
5
  Home-page: https://github.com/firstof9/python-openevse-http
6
6
  Download-URL: https://github.com/firstof9/python-openevse-http
@@ -1312,6 +1312,20 @@ class OpenEVSE:
1312
1312
  return round(self._status["voltage"] * self._status["amp"], 2)
1313
1313
  return None
1314
1314
 
1315
+ # Shaper HTTP Posting
1316
+ async def set_shaper_live_pwr(self, power: int) -> None:
1317
+ """Send pushed sensor data to shaper."""
1318
+ if not self._version_check("4.0.0"):
1319
+ _LOGGER.debug("Feature not supported for older firmware.")
1320
+ raise UnsupportedFeature
1321
+
1322
+ url = f"{self.url}status"
1323
+ data = {"shaper_live_pwr": power}
1324
+
1325
+ _LOGGER.debug("Posting shaper data: %s", data)
1326
+ response = await self.process_request(url=url, method="post", data=data)
1327
+ _LOGGER.debug("Shaper response: %s", response)
1328
+
1315
1329
  # Shaper values
1316
1330
  @property
1317
1331
  def shaper_active(self) -> bool | None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python_openevse_http
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Python wrapper for OpenEVSE HTTP API
5
5
  Home-page: https://github.com/firstof9/python-openevse-http
6
6
  Download-URL: https://github.com/firstof9/python-openevse-http
@@ -6,7 +6,7 @@ from setuptools import find_packages, setup
6
6
 
7
7
  PROJECT_DIR = Path(__file__).parent.resolve()
8
8
  README_FILE = PROJECT_DIR / "README.md"
9
- VERSION = "0.2.4"
9
+ VERSION = "0.2.5"
10
10
 
11
11
  setup(
12
12
  name="python_openevse_http",
@@ -1,12 +1,11 @@
1
1
  """Test external session management."""
2
2
 
3
3
  import json
4
- from unittest.mock import AsyncMock, MagicMock, patch
4
+ from unittest.mock import AsyncMock, MagicMock
5
5
 
6
6
  import aiohttp
7
7
  import pytest
8
8
 
9
- import openevsehttp.__main__ as main
10
9
  from openevsehttp.__main__ import OpenEVSE
11
10
  from tests.common import load_fixture
12
11
 
@@ -11,7 +11,6 @@ import aiohttp
11
11
  import pytest
12
12
  from aiohttp.client_exceptions import ContentTypeError, ServerTimeoutError
13
13
  from aiohttp.client_reqrep import ConnectionKey
14
- from awesomeversion import AwesomeVersion
15
14
  from awesomeversion.exceptions import AwesomeVersionCompareException
16
15
  from freezegun import freeze_time
17
16
 
@@ -1271,6 +1270,38 @@ async def test_shaper_max_power(fixture, expected, request):
1271
1270
  await charger.ws_disconnect()
1272
1271
 
1273
1272
 
1273
+ async def test_set_shaper_live_power(
1274
+ test_charger, test_charger_v2, mock_aioclient, caplog
1275
+ ):
1276
+ """Test setting shaper live power."""
1277
+ await test_charger.update()
1278
+ mock_aioclient.post(
1279
+ TEST_URL_STATUS,
1280
+ status=200,
1281
+ body='{"shaper_live_pwr": 210}',
1282
+ )
1283
+ with caplog.at_level(logging.DEBUG):
1284
+ await test_charger.set_shaper_live_pwr(210)
1285
+ assert "Posting shaper data: {'shaper_live_pwr': 210}" in caplog.text
1286
+ assert "Shaper response: {'shaper_live_pwr': 210}" in caplog.text
1287
+
1288
+ mock_aioclient.post(
1289
+ TEST_URL_STATUS,
1290
+ status=200,
1291
+ body='{"shaper_live_pwr": 0}',
1292
+ )
1293
+ with caplog.at_level(logging.DEBUG):
1294
+ await test_charger.set_shaper_live_pwr(0)
1295
+ assert "Posting shaper data: {'shaper_live_pwr': 0}" in caplog.text
1296
+
1297
+ await test_charger_v2.update()
1298
+ with pytest.raises(UnsupportedFeature):
1299
+ with caplog.at_level(logging.DEBUG):
1300
+ await test_charger_v2.set_shaper_live_pwr(210)
1301
+ assert "Feature not supported for older firmware." in caplog.text
1302
+ await test_charger_v2.ws_disconnect()
1303
+
1304
+
1274
1305
  @pytest.mark.parametrize(
1275
1306
  "fixture, expected", [("test_charger", 75), ("test_charger_v2", None)]
1276
1307
  )