Homevolt 0.2.1__py3-none-any.whl → 0.2.3__py3-none-any.whl
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.
- homevolt/device.py +8 -8
- homevolt/homevolt.py +6 -4
- {homevolt-0.2.1.dist-info → homevolt-0.2.3.dist-info}/METADATA +1 -1
- homevolt-0.2.3.dist-info/RECORD +10 -0
- homevolt-0.2.1.dist-info/RECORD +0 -10
- {homevolt-0.2.1.dist-info → homevolt-0.2.3.dist-info}/WHEEL +0 -0
- {homevolt-0.2.1.dist-info → homevolt-0.2.3.dist-info}/top_level.txt +0 -0
homevolt/device.py
CHANGED
|
@@ -30,18 +30,18 @@ class Device:
|
|
|
30
30
|
|
|
31
31
|
def __init__(
|
|
32
32
|
self,
|
|
33
|
-
|
|
33
|
+
hostname: str,
|
|
34
34
|
password: str | None,
|
|
35
35
|
websession: aiohttp.ClientSession,
|
|
36
36
|
) -> None:
|
|
37
37
|
"""Initialize the device.
|
|
38
38
|
|
|
39
39
|
Args:
|
|
40
|
-
|
|
40
|
+
hostname: Hostname of the Homevolt device
|
|
41
41
|
password: Optional password for authentication
|
|
42
42
|
websession: aiohttp ClientSession for making requests
|
|
43
43
|
"""
|
|
44
|
-
self.
|
|
44
|
+
self.hostname = hostname
|
|
45
45
|
self._password = password
|
|
46
46
|
self._websession = websession
|
|
47
47
|
self._auth = aiohttp.BasicAuth("admin", password) if password else None
|
|
@@ -59,7 +59,7 @@ class Device:
|
|
|
59
59
|
async def fetch_ems_data(self) -> None:
|
|
60
60
|
"""Fetch EMS data from the device."""
|
|
61
61
|
try:
|
|
62
|
-
url = f"
|
|
62
|
+
url = f"{self.hostname}{ENDPOINT_EMS}"
|
|
63
63
|
async with self._websession.get(url, auth=self._auth) as response:
|
|
64
64
|
if response.status == 401:
|
|
65
65
|
raise HomevoltAuthenticationError("Authentication failed")
|
|
@@ -75,7 +75,7 @@ class Device:
|
|
|
75
75
|
async def fetch_schedule_data(self) -> None:
|
|
76
76
|
"""Fetch schedule data from the device."""
|
|
77
77
|
try:
|
|
78
|
-
url = f"
|
|
78
|
+
url = f"{self.hostname}{ENDPOINT_SCHEDULE}"
|
|
79
79
|
async with self._websession.get(url, auth=self._auth) as response:
|
|
80
80
|
if response.status == 401:
|
|
81
81
|
raise HomevoltAuthenticationError("Authentication failed")
|
|
@@ -381,7 +381,7 @@ class Device:
|
|
|
381
381
|
HomevoltDataError: If response parsing fails
|
|
382
382
|
"""
|
|
383
383
|
try:
|
|
384
|
-
url = f"
|
|
384
|
+
url = f"{self.hostname}{ENDPOINT_CONSOLE}"
|
|
385
385
|
async with self._websession.post(
|
|
386
386
|
url,
|
|
387
387
|
auth=self._auth,
|
|
@@ -589,7 +589,7 @@ class Device:
|
|
|
589
589
|
HomevoltDataError: If parameter setting fails
|
|
590
590
|
"""
|
|
591
591
|
try:
|
|
592
|
-
url = f"
|
|
592
|
+
url = f"{self.hostname}{ENDPOINT_PARAMS}"
|
|
593
593
|
async with self._websession.post(
|
|
594
594
|
url,
|
|
595
595
|
auth=self._auth,
|
|
@@ -619,7 +619,7 @@ class Device:
|
|
|
619
619
|
HomevoltDataError: If parameter retrieval fails
|
|
620
620
|
"""
|
|
621
621
|
try:
|
|
622
|
-
url = f"
|
|
622
|
+
url = f"{self.hostname}{ENDPOINT_PARAMS}"
|
|
623
623
|
async with self._websession.get(url, auth=self._auth) as response:
|
|
624
624
|
if response.status == 401:
|
|
625
625
|
raise HomevoltAuthenticationError("Authentication failed")
|
homevolt/homevolt.py
CHANGED
|
@@ -16,18 +16,20 @@ class Homevolt:
|
|
|
16
16
|
|
|
17
17
|
def __init__(
|
|
18
18
|
self,
|
|
19
|
-
|
|
19
|
+
hostname: str,
|
|
20
20
|
password: str | None = None,
|
|
21
21
|
websession: aiohttp.ClientSession | None = None,
|
|
22
22
|
) -> None:
|
|
23
23
|
"""Initialize the Homevolt connection.
|
|
24
24
|
|
|
25
25
|
Args:
|
|
26
|
-
|
|
26
|
+
hostname: Hostname of the Homevolt device
|
|
27
27
|
password: Optional password for authentication
|
|
28
28
|
websession: Optional aiohttp ClientSession. If not provided, one will be created.
|
|
29
29
|
"""
|
|
30
|
-
|
|
30
|
+
if not hostname.startswith("http"):
|
|
31
|
+
hostname = f"http://{hostname}"
|
|
32
|
+
self.hostname = hostname
|
|
31
33
|
self._password = password
|
|
32
34
|
self._websession = websession
|
|
33
35
|
self._own_session = websession is None
|
|
@@ -40,7 +42,7 @@ class Homevolt:
|
|
|
40
42
|
await self._ensure_session()
|
|
41
43
|
assert self._websession is not None
|
|
42
44
|
self._device = Device(
|
|
43
|
-
|
|
45
|
+
hostname=self.hostname,
|
|
44
46
|
password=self._password,
|
|
45
47
|
websession=self._websession,
|
|
46
48
|
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
homevolt/__init__.py,sha256=HAK08jrG9KyS7Nd3tJT4QRhmx3a3AY4tlh_szh_09cg,504
|
|
2
|
+
homevolt/const.py,sha256=hpiyo292WKIOfULnaJVY7n7afkn5cSQtqQFhQlQBpa4,609
|
|
3
|
+
homevolt/device.py,sha256=0RM56ynVvR39U-TeVEPcMFsco3viwE8shJIf4nwi4Z0,28301
|
|
4
|
+
homevolt/exceptions.py,sha256=TeG1J92JsbBpJok6Qpbdu4ENm9OjVMNgeHPcUoYjzdw,488
|
|
5
|
+
homevolt/homevolt.py,sha256=e5k6L1pEHZWuM3B1le9FTTRm23xSL8s12Vc99cL6pp4,2587
|
|
6
|
+
homevolt/models.py,sha256=YrzTuAsFbfG4c-XhZMYtIZAe6qhEsDmZZdL5zPLHnOA,928
|
|
7
|
+
homevolt-0.2.3.dist-info/METADATA,sha256=5ZSGKS4ZaQhBT1xwungysKkrOw8mMOwSCwfY5AtxpAA,8062
|
|
8
|
+
homevolt-0.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
homevolt-0.2.3.dist-info/top_level.txt,sha256=eOPhiXXDJEiBEdExWtFc_UqWSnbLbFpEsMm3fCXrBTA,9
|
|
10
|
+
homevolt-0.2.3.dist-info/RECORD,,
|
homevolt-0.2.1.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
homevolt/__init__.py,sha256=HAK08jrG9KyS7Nd3tJT4QRhmx3a3AY4tlh_szh_09cg,504
|
|
2
|
-
homevolt/const.py,sha256=hpiyo292WKIOfULnaJVY7n7afkn5cSQtqQFhQlQBpa4,609
|
|
3
|
-
homevolt/device.py,sha256=T-kN6IFX1gf8C_3stUNm2uQG1PWjnYKn-_nxSwAlGks,28356
|
|
4
|
-
homevolt/exceptions.py,sha256=TeG1J92JsbBpJok6Qpbdu4ENm9OjVMNgeHPcUoYjzdw,488
|
|
5
|
-
homevolt/homevolt.py,sha256=WEb89sqVa8dccoYEqvAuZEjPltGamlJPfGII0bqA5_g,2513
|
|
6
|
-
homevolt/models.py,sha256=YrzTuAsFbfG4c-XhZMYtIZAe6qhEsDmZZdL5zPLHnOA,928
|
|
7
|
-
homevolt-0.2.1.dist-info/METADATA,sha256=KXkdDKlzg5USHsGTX8JmGzdLdcOOpN3-QLKBizYNFyM,8062
|
|
8
|
-
homevolt-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
homevolt-0.2.1.dist-info/top_level.txt,sha256=eOPhiXXDJEiBEdExWtFc_UqWSnbLbFpEsMm3fCXrBTA,9
|
|
10
|
-
homevolt-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|