Async Python client for Sugar Valley NeoPool / VistaPool / Hidrolife Modbus pool controllers
Project description
neopool-modbus
Async Python client for Sugar Valley NeoPool pool controllers (sold under brands VistaPool, Hidrolife, Aquascenic, Oxilife, Hayward, Brilix, Bayrol) connected via Modbus TCP.
This library is the communication layer extracted from the
Home Assistant neopool integration
and is suitable for any async Python project — Home Assistant integrations,
scripts, dashboards, or custom automation.
Installation
pip install neopool-modbus
Requires Python 3.13+ and pymodbus>=3.10.0 (installed transitively).
Quick start
import asyncio
from neopool_modbus import NeoPoolModbusClient
async def main() -> None:
client = NeoPoolModbusClient(
{"host": "192.168.1.42", "port": 502, "slave_id": 1}
)
try:
data = await client.async_read_all()
# Keys are the upstream Sugar Valley register names from
# https://github.com/arendst/Tasmota/.../xsns_83_neopool.ino,
# values are decoded into native Python types.
print(f"pH: {data['MBF_MEASURE_PH']}") # e.g. 7.42
print(f"Temperature: {data['MBF_MEASURE_TEMPERATURE']} °C") # e.g. 27.3
print(f"Hydrolysis: {data['MBF_HIDRO_CURRENT']}") # e.g. 6.5
finally:
await client.close()
asyncio.run(main())
The client is lazy — it opens the TCP connection on first use and reuses it
across calls; close() releases the socket and resets retry/backoff state.
Public API
from neopool_modbus import (
NeoPoolModbusClient,
NeoPoolError,
NeoPoolConnectionError,
NeoPoolTimeoutError,
)
from neopool_modbus.registers import (
EXEC_REGISTER,
EEPROM_SAVE_REGISTER,
HEATING_SETPOINT_REGISTER,
INTELLIGENT_SETPOINT_REGISTER,
MANUAL_FILTRATION_REGISTER,
TIMER_BLOCKS,
is_valid_relay_gpio,
)
from neopool_modbus.decoders import (
parse_timer_block,
build_timer_block,
hhmm_to_seconds,
seconds_to_hhmm,
get_machine_name,
is_hydrolysis_in_percent,
# ... see neopool_modbus.decoders for the full list
)
from neopool_modbus.status_mask import (
decode_relay_state,
decode_named_relay_states,
decode_uv_lamp_state,
decode_hidro_status_bits,
decode_ion_status_bits,
decode_ph_rx_cl_cd_status_bits,
)
The exception hierarchy (NeoPoolError → NeoPoolConnectionError /
NeoPoolTimeoutError) is a forward-compatible contract; today the client
still raises the underlying pymodbus exceptions directly. Catching
Exception is the only safe choice for now.
Features
- Async I/O on top of
pymodbus.AsyncModbusTcpClient - Batched register reads — one round-trip per protocol page, with notification-bit-driven cache invalidation so unchanged pages skip the read
- Exponential connection retry with bounded backoff
- Write-and-verify cycle for configuration registers
- Capability detection (hydrolysis, pH, Redox, chlorine, conductivity, ION)
- Strict type hints (
py.typed), 100 % unit-test coverage
Logging
The library uses a single logger named neopool_modbus. Enable it like any
other Python logger:
import logging
logging.getLogger("neopool_modbus").setLevel(logging.DEBUG)
Home Assistant users can flip the integration's "Enable debug logging" toggle
in the UI; the integration's manifest.json lists neopool_modbus so the
toggle covers the library too.
License
Apache 2.0 — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neopool_modbus-1.0.0.tar.gz.
File metadata
- Download URL: neopool_modbus-1.0.0.tar.gz
- Upload date:
- Size: 54.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86e918e07863ed1fc973ace8754412f565a455d93e60389cf1bd012d6b6fb798
|
|
| MD5 |
5b8a5afd76c64ee6f41953db079a0b26
|
|
| BLAKE2b-256 |
ef8174316b907da51ec16b6a3735e6f1968ac1e837f90bb397815987ac93729b
|
Provenance
The following attestation bundles were made for neopool_modbus-1.0.0.tar.gz:
Publisher:
release.yaml on Svasek/python-neopool-modbus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
neopool_modbus-1.0.0.tar.gz -
Subject digest:
86e918e07863ed1fc973ace8754412f565a455d93e60389cf1bd012d6b6fb798 - Sigstore transparency entry: 1740738622
- Sigstore integration time:
-
Permalink:
Svasek/python-neopool-modbus@ca4eb5ae14a6d7c208886546b914c0cf355624f6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Svasek
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@ca4eb5ae14a6d7c208886546b914c0cf355624f6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file neopool_modbus-1.0.0-py3-none-any.whl.
File metadata
- Download URL: neopool_modbus-1.0.0-py3-none-any.whl
- Upload date:
- Size: 36.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ee629690329aae8ddd0455c5506e75c4654cdb24b0d8034f2a90bac99c5e004
|
|
| MD5 |
d5f80dd6479e25a5948c20c140d607d0
|
|
| BLAKE2b-256 |
5dc2d7bb91495f127767a5f85f64be3bb1ac06bc7ff798f569a2dfb785cf05c3
|
Provenance
The following attestation bundles were made for neopool_modbus-1.0.0-py3-none-any.whl:
Publisher:
release.yaml on Svasek/python-neopool-modbus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
neopool_modbus-1.0.0-py3-none-any.whl -
Subject digest:
9ee629690329aae8ddd0455c5506e75c4654cdb24b0d8034f2a90bac99c5e004 - Sigstore transparency entry: 1740738678
- Sigstore integration time:
-
Permalink:
Svasek/python-neopool-modbus@ca4eb5ae14a6d7c208886546b914c0cf355624f6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Svasek
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@ca4eb5ae14a6d7c208886546b914c0cf355624f6 -
Trigger Event:
push
-
Statement type: