Homevolt 0.2.1__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.
- {homevolt-0.2.1 → homevolt-0.2.2}/Homevolt.egg-info/PKG-INFO +1 -1
- {homevolt-0.2.1 → homevolt-0.2.2}/PKG-INFO +1 -1
- {homevolt-0.2.1 → homevolt-0.2.2}/homevolt/device.py +10 -8
- {homevolt-0.2.1 → homevolt-0.2.2}/homevolt/homevolt.py +4 -4
- {homevolt-0.2.1 → homevolt-0.2.2}/pyproject.toml +1 -1
- {homevolt-0.2.1 → homevolt-0.2.2}/Homevolt.egg-info/SOURCES.txt +0 -0
- {homevolt-0.2.1 → homevolt-0.2.2}/Homevolt.egg-info/dependency_links.txt +0 -0
- {homevolt-0.2.1 → homevolt-0.2.2}/Homevolt.egg-info/requires.txt +0 -0
- {homevolt-0.2.1 → homevolt-0.2.2}/Homevolt.egg-info/top_level.txt +0 -0
- {homevolt-0.2.1 → homevolt-0.2.2}/README.md +0 -0
- {homevolt-0.2.1 → homevolt-0.2.2}/homevolt/__init__.py +0 -0
- {homevolt-0.2.1 → homevolt-0.2.2}/homevolt/const.py +0 -0
- {homevolt-0.2.1 → homevolt-0.2.2}/homevolt/exceptions.py +0 -0
- {homevolt-0.2.1 → homevolt-0.2.2}/homevolt/models.py +0 -0
- {homevolt-0.2.1 → homevolt-0.2.2}/setup.cfg +0 -0
|
@@ -30,18 +30,20 @@ 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
|
-
|
|
44
|
+
if not hostname.startswith("http"):
|
|
45
|
+
hostname = f"http://{hostname}"
|
|
46
|
+
self.hostname = hostname
|
|
45
47
|
self._password = password
|
|
46
48
|
self._websession = websession
|
|
47
49
|
self._auth = aiohttp.BasicAuth("admin", password) if password else None
|
|
@@ -59,7 +61,7 @@ class Device:
|
|
|
59
61
|
async def fetch_ems_data(self) -> None:
|
|
60
62
|
"""Fetch EMS data from the device."""
|
|
61
63
|
try:
|
|
62
|
-
url = f"
|
|
64
|
+
url = f"{self.hostname}{ENDPOINT_EMS}"
|
|
63
65
|
async with self._websession.get(url, auth=self._auth) as response:
|
|
64
66
|
if response.status == 401:
|
|
65
67
|
raise HomevoltAuthenticationError("Authentication failed")
|
|
@@ -75,7 +77,7 @@ class Device:
|
|
|
75
77
|
async def fetch_schedule_data(self) -> None:
|
|
76
78
|
"""Fetch schedule data from the device."""
|
|
77
79
|
try:
|
|
78
|
-
url = f"
|
|
80
|
+
url = f"{self.hostname}{ENDPOINT_SCHEDULE}"
|
|
79
81
|
async with self._websession.get(url, auth=self._auth) as response:
|
|
80
82
|
if response.status == 401:
|
|
81
83
|
raise HomevoltAuthenticationError("Authentication failed")
|
|
@@ -381,7 +383,7 @@ class Device:
|
|
|
381
383
|
HomevoltDataError: If response parsing fails
|
|
382
384
|
"""
|
|
383
385
|
try:
|
|
384
|
-
url = f"
|
|
386
|
+
url = f"{self.hostname}{ENDPOINT_CONSOLE}"
|
|
385
387
|
async with self._websession.post(
|
|
386
388
|
url,
|
|
387
389
|
auth=self._auth,
|
|
@@ -589,7 +591,7 @@ class Device:
|
|
|
589
591
|
HomevoltDataError: If parameter setting fails
|
|
590
592
|
"""
|
|
591
593
|
try:
|
|
592
|
-
url = f"
|
|
594
|
+
url = f"{self.hostname}{ENDPOINT_PARAMS}"
|
|
593
595
|
async with self._websession.post(
|
|
594
596
|
url,
|
|
595
597
|
auth=self._auth,
|
|
@@ -619,7 +621,7 @@ class Device:
|
|
|
619
621
|
HomevoltDataError: If parameter retrieval fails
|
|
620
622
|
"""
|
|
621
623
|
try:
|
|
622
|
-
url = f"
|
|
624
|
+
url = f"{self.hostname}{ENDPOINT_PARAMS}"
|
|
623
625
|
async with self._websession.get(url, auth=self._auth) as response:
|
|
624
626
|
if response.status == 401:
|
|
625
627
|
raise HomevoltAuthenticationError("Authentication failed")
|
|
@@ -16,18 +16,18 @@ 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
|
-
self.
|
|
30
|
+
self.hostname = hostname
|
|
31
31
|
self._password = password
|
|
32
32
|
self._websession = websession
|
|
33
33
|
self._own_session = websession is None
|
|
@@ -40,7 +40,7 @@ class Homevolt:
|
|
|
40
40
|
await self._ensure_session()
|
|
41
41
|
assert self._websession is not None
|
|
42
42
|
self._device = Device(
|
|
43
|
-
|
|
43
|
+
hostname=self.hostname,
|
|
44
44
|
password=self._password,
|
|
45
45
|
websession=self._websession,
|
|
46
46
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|