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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Homevolt
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Python library for Homevolt EMS devices
5
5
  Author-email: Your Name <your.email@example.com>
6
6
  License: GPL-3.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Homevolt
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Python library for Homevolt EMS devices
5
5
  Author-email: Your Name <your.email@example.com>
6
6
  License: GPL-3.0
@@ -30,18 +30,20 @@ class Device:
30
30
 
31
31
  def __init__(
32
32
  self,
33
- ip_address: str,
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
- ip_address: IP address of the Homevolt device
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.ip_address = ip_address
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"http://{self.ip_address}{ENDPOINT_EMS}"
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"http://{self.ip_address}{ENDPOINT_SCHEDULE}"
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"http://{self.ip_address}{ENDPOINT_CONSOLE}"
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"http://{self.ip_address}{ENDPOINT_PARAMS}"
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"http://{self.ip_address}{ENDPOINT_PARAMS}"
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
- ip_address: str,
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
- ip_address: IP address of the Homevolt device
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.ip_address = ip_address
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
- ip_address=self.ip_address,
43
+ hostname=self.hostname,
44
44
  password=self._password,
45
45
  websession=self._websession,
46
46
  )
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "Homevolt"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Python library for Homevolt EMS devices"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
File without changes
File without changes
File without changes
File without changes
File without changes