pyHomevolt
Python library for Homevolt EMS devices.
Get real-time data from your Homevolt Energy Management System, including:
- Voltage, current, and power measurements
- Battery state of charge and temperature
- Grid, solar, and load sensor data
- Schedule information
Control your battery with:
- Immediate battery control (charge, discharge, idle)
- Scheduled battery operations
- Local mode management
- Parameter configuration
Install
pip install homevolt
Development
This repository supports a standard uv development workflow.
uv sync --dev
That creates a local environment with the package and development tools installed.
Common commands:
uv run pre-commit run --all-files
uv run ruff check .
uv run mypy homevolt
uv run pytest
Example
import asyncio
import aiohttp
import homevolt
async def main():
async with aiohttp.ClientSession() as session:
homevolt_connection = homevolt.Homevolt(
host="192.168.1.100",
password="optional_password",
websession=session,
)
await homevolt_connection.update_info()
print(f"Device ID: {homevolt_connection.unique_id}")
print(f"Current Power: {homevolt_connection.sensors['Power'].value} W")
print(f"Battery SOC: {homevolt_connection.sensors['Battery State of Charge'].value * 100}%")
# Access all sensors
for sensor_name, sensor in homevolt_connection.sensors.items():
print(f"{sensor_name}: {sensor.value} ({sensor.type.value})")
# Access device metadata
for device_id, metadata in homevolt_connection.device_metadata.items():
print(f"{device_id}: {metadata.name} ({metadata.model})")
await homevolt_connection.close_connection()
if __name__ == "__main__":
asyncio.run(main())
Example with context manager
import asyncio
import aiohttp
import homevolt
async def main():
async with aiohttp.ClientSession() as session:
async with homevolt.Homevolt(
host="192.168.1.100",
password="optional_password",
websession=session,
) as homevolt_connection:
await homevolt_connection.update_info()
print(f"Device ID: {homevolt_connection.unique_id}")
print(f"Available sensors: {list(homevolt_connection.sensors.keys())}")
if __name__ == "__main__":
asyncio.run(main())
Battery Control Example
import asyncio
import aiohttp
import homevolt
async def main():
async with aiohttp.ClientSession() as session:
async with homevolt.Homevolt(
host="192.168.1.100",
password="optional_password",
websession=session,
) as homevolt_connection:
await homevolt_connection.update_info()
# Enable local mode to prevent remote schedule overrides
await homevolt_connection.enable_local_mode()
# Replace the current schedule with immediate inverter-charge control.
await homevolt_connection.set_battery_mode("inverter_charge")
# Refresh once so the new Manual Schedule entry can be updated safely.
await homevolt_connection.fetch_schedule_data()
await homevolt_connection.set_battery_parameters(
max_charge=3000,
min_soc=20,
max_soc=90,
)
if __name__ == "__main__":
asyncio.run(main())
Battery Control Modes
The following mode strings are available for battery control:
idle: Battery standby (mode 0)inverter_charge: Charge via the inverter from grid/solar (mode 1)inverter_discharge: Discharge via the inverter to home/grid (mode 2)frequency_reserve: Frequency regulation service mode (mode 6)solar_charge: Charge from solar production only (mode 7)
Other firmware schedule types are intentionally rejected because current firmware does not create a matching manual schedule for them.
Battery writes require local mode to be enabled first. set_battery_mode() uses the
device's sched_set command, so it replaces the complete current schedule with one
immediate Manual Schedule entry. set_battery_parameters() only accepts that
single manual entry and refuses writes that would discard unsupported parameters.
API Reference
Homevolt
Main class for connecting to a Homevolt device.
Homevolt(host, password=None, websession=None)
Initialize a Homevolt connection.
host(str): Hostname or IP address of the Homevolt devicepassword(str, optional): Password for authenticationwebsession(aiohttp.ClientSession, optional): HTTP session. If not provided, one will be created.
Properties
unique_id(str | None): Device unique identifiersensors(dict[str, Sensor]): Dictionary of sensor readingsdevice_metadata(dict[str, DeviceMetadata]): Dictionary of device metadatacurrent_schedule(dict | None): Current schedule informationbattery_parameters_writable(bool): Whether the current manual entry supports partial writes
Methods
async update_info(): Fetch and update all device informationasync fetch_ems_data(): Fetch EMS data specificallyasync fetch_schedule_data(): Fetch schedule data specificallyasync close_connection(): Close the connection and clean up resources
Battery Control Methods
async set_battery_mode(mode): Replace the schedule with an immediate control modeasync set_battery_parameters(**kwargs): Update supported values on one manual entry
Configuration:
async enable_local_mode(): Enable local mode (prevents remote overrides)async disable_local_mode(): Disable local mode (allows remote overrides)
Data Models
Sensor
value(float | str | None): Sensor valuetype(SensorType): Type of sensordevice_identifier(str): Device identifier for grouping sensors
DeviceMetadata
name(str): Device namemodel(str): Device model
SensorType
Enumeration of sensor types:
VOLTAGECURRENTPOWERENERGY_INCREASINGENERGY_TOTALFREQUENCYTEMPERATUREPERCENTAGESIGNAL_STRENGTHCOUNTTEXTSCHEDULE_TYPE
Exceptions
HomevoltError: Base exception for all Homevolt errorsHomevoltConnectionError: Connection or network errorsHomevoltAuthenticationError: Authentication failuresHomevoltDataError: Data parsing errors
License
GPL-3.0
Release files for Homevolt 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| homevolt-0.6.0.tar.gz | 30.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| homevolt-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.0 kB
Release files / homevolt-0.6.0.tar.gz
| Download URL | homevolt-0.6.0.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
136c3141e95df3ebcc43fa10c80c8bc684e3ce5d75cdceaa994e91f678a8aae1
|
|
BLAKE2b-256 checksum How to use checksums |
eb1130269c0a4b5a45a96b2bbecefd551d9ac06ed8588474ed5499ea887db80c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / homevolt-0.6.0-py3-none-any.whl
| Download URL | homevolt-0.6.0-py3-none-any.whl |
|---|---|
| Size | 24.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd1d3e4c7d327cda8fb960f227c90cbbb581c8b260689379c3de78acd518fd5f
|
|
BLAKE2b-256 checksum How to use checksums |
2d4f2e35a22af235f31d6d3cf7ebe4ffa0c90d2099feae647866c4a057fd1651
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|