Homevolt 0.2.3__tar.gz → 0.3.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.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Homevolt
3
- Version: 0.2.3
3
+ Version: 0.3.0
4
4
  Summary: Python library for Homevolt EMS devices
5
- Author-email: Your Name <your.email@example.com>
5
+ Author-email: Daniel Høyer <github@dahoiv.net>
6
6
  License: GPL-3.0
7
7
  Classifier: Development Status :: 4 - Beta
8
8
  Classifier: Intended Audience :: Developers
@@ -12,7 +12,9 @@ Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
13
  Requires-Python: >=3.12
14
14
  Description-Content-Type: text/markdown
15
+ License-File: LICENSE
15
16
  Requires-Dist: aiohttp>=3.8.0
17
+ Dynamic: license-file
16
18
 
17
19
  # pyHomevolt
18
20
 
@@ -47,23 +49,22 @@ import homevolt
47
49
  async def main():
48
50
  async with aiohttp.ClientSession() as session:
49
51
  homevolt_connection = homevolt.Homevolt(
50
- ip_address="192.168.1.100",
52
+ host="192.168.1.100",
51
53
  password="optional_password",
52
54
  websession=session,
53
55
  )
54
56
  await homevolt_connection.update_info()
55
57
 
56
- device = homevolt_connection.get_device()
57
- print(f"Device ID: {device.device_id}")
58
- print(f"Current Power: {device.sensors['Power'].value} W")
59
- print(f"Battery SOC: {device.sensors['Battery State of Charge'].value * 100}%")
58
+ print(f"Device ID: {homevolt_connection.unique_id}")
59
+ print(f"Current Power: {homevolt_connection.sensors['Power'].value} W")
60
+ print(f"Battery SOC: {homevolt_connection.sensors['Battery State of Charge'].value * 100}%")
60
61
 
61
62
  # Access all sensors
62
- for sensor_name, sensor in device.sensors.items():
63
+ for sensor_name, sensor in homevolt_connection.sensors.items():
63
64
  print(f"{sensor_name}: {sensor.value} ({sensor.type.value})")
64
65
 
65
66
  # Access device metadata
66
- for device_id, metadata in device.device_metadata.items():
67
+ for device_id, metadata in homevolt_connection.device_metadata.items():
67
68
  print(f"{device_id}: {metadata.name} ({metadata.model})")
68
69
 
69
70
  await homevolt_connection.close_connection()
@@ -84,17 +85,14 @@ import homevolt
84
85
  async def main():
85
86
  async with aiohttp.ClientSession() as session:
86
87
  async with homevolt.Homevolt(
87
- ip_address="192.168.1.100",
88
+ host="192.168.1.100",
88
89
  password="optional_password",
89
90
  websession=session,
90
91
  ) as homevolt_connection:
91
92
  await homevolt_connection.update_info()
92
93
 
93
- device = homevolt_connection.get_device()
94
- await device.update_info() # Refresh data
95
-
96
- print(f"Device ID: {device.device_id}")
97
- print(f"Available sensors: {list(device.sensors.keys())}")
94
+ print(f"Device ID: {homevolt_connection.unique_id}")
95
+ print(f"Available sensors: {list(homevolt_connection.sensors.keys())}")
98
96
 
99
97
 
100
98
  if __name__ == "__main__":
@@ -112,21 +110,20 @@ import homevolt
112
110
  async def main():
113
111
  async with aiohttp.ClientSession() as session:
114
112
  async with homevolt.Homevolt(
115
- ip_address="192.168.1.100",
113
+ host="192.168.1.100",
116
114
  password="optional_password",
117
115
  websession=session,
118
116
  ) as homevolt_connection:
119
117
  await homevolt_connection.update_info()
120
- device = homevolt_connection.get_device()
121
118
 
122
119
  # Enable local mode to prevent remote schedule overrides
123
- await device.enable_local_mode()
120
+ await homevolt_connection.enable_local_mode()
124
121
 
125
122
  # Charge battery immediately (up to 3000W, stop at 90% SOC)
126
- await device.charge_battery(max_power=3000, max_soc=90)
123
+ await homevolt_connection.charge_battery(max_power=3000, max_soc=90)
127
124
 
128
125
  # Or use the full control method
129
- await device.set_battery_mode(
126
+ await homevolt_connection.set_battery_mode(
130
127
  mode=1, # Inverter Charge
131
128
  max_charge=3000,
132
129
  max_soc=90,
@@ -137,7 +134,7 @@ async def main():
137
134
  tonight = datetime.now().replace(hour=23, minute=0, second=0)
138
135
  tomorrow = (tonight + timedelta(days=1)).replace(hour=7, minute=0, second=0)
139
136
 
140
- await device.add_schedule(
137
+ await homevolt_connection.add_schedule(
141
138
  mode=1, # Inverter Charge
142
139
  from_time=tonight.isoformat(),
143
140
  to_time=tomorrow.isoformat(),
@@ -146,10 +143,10 @@ async def main():
146
143
  )
147
144
 
148
145
  # Set battery to idle
149
- await device.set_battery_idle()
146
+ await homevolt_connection.set_battery_idle()
150
147
 
151
148
  # Discharge during peak hours
152
- await device.discharge_battery(max_power=2500, min_soc=30)
149
+ await homevolt_connection.discharge_battery(max_power=2500, min_soc=30)
153
150
 
154
151
 
155
152
  if __name__ == "__main__":
@@ -177,36 +174,27 @@ The following modes are available for battery control:
177
174
 
178
175
  Main class for connecting to a Homevolt device.
179
176
 
180
- #### `Homevolt(ip_address, password=None, websession=None)`
177
+ #### `Homevolt(host, password=None, websession=None)`
181
178
 
182
179
  Initialize a Homevolt connection.
183
180
 
184
- - `ip_address` (str): IP address of the Homevolt device
181
+ - `host` (str): Hostname or IP address of the Homevolt device
185
182
  - `password` (str, optional): Password for authentication
186
183
  - `websession` (aiohttp.ClientSession, optional): HTTP session. If not provided, one will be created.
187
184
 
188
- #### Methods
189
-
190
- - `async update_info()`: Fetch and update device information
191
- - `get_device()`: Get the Device object
192
- - `async close_connection()`: Close the connection and clean up resources
193
-
194
- ### Device
195
-
196
- Represents a Homevolt EMS device.
197
-
198
185
  #### Properties
199
186
 
200
- - `device_id` (str): Device identifier
187
+ - `unique_id` (str | None): Device unique identifier
201
188
  - `sensors` (dict[str, Sensor]): Dictionary of sensor readings
202
189
  - `device_metadata` (dict[str, DeviceMetadata]): Dictionary of device metadata
203
- - `current_schedule` (dict): Current schedule information
190
+ - `current_schedule` (dict | None): Current schedule information
204
191
 
205
192
  #### Methods
206
193
 
207
- - `async update_info()`: Fetch latest EMS and schedule data
194
+ - `async update_info()`: Fetch and update all device information
208
195
  - `async fetch_ems_data()`: Fetch EMS data specifically
209
196
  - `async fetch_schedule_data()`: Fetch schedule data specifically
197
+ - `async close_connection()`: Close the connection and clean up resources
210
198
 
211
199
  #### Battery Control Methods
212
200
 
@@ -1,3 +1,4 @@
1
+ LICENSE
1
2
  README.md
2
3
  pyproject.toml
3
4
  Homevolt.egg-info/PKG-INFO
@@ -7,7 +8,6 @@ Homevolt.egg-info/requires.txt
7
8
  Homevolt.egg-info/top_level.txt
8
9
  homevolt/__init__.py
9
10
  homevolt/const.py
10
- homevolt/device.py
11
11
  homevolt/exceptions.py
12
12
  homevolt/homevolt.py
13
13
  homevolt/models.py