Async helper library for controlling Flexit A/C units over the CI66 Modbus adapter, built on top of pymodbus's async clients.
This is an async fork of Sabesto/pyflexit, updated to work with modern (3.x) pymodbus, which dropped the synchronous client API this library originally relied on.
Supports both Modbus TCP and Modbus RTU over a serial/RS-485 connection.
import asyncio
from pyflexit import Flexit
async def main() -> None:
# Serial (RS-485) connection:
unit = Flexit(21, serial_port="/dev/ttyUSB0")
# Or a Modbus TCP gateway:
# unit = Flexit(21, host="192.168.1.50")
await unit.connect()
try:
await unit.update()
print(unit.current_temperature)
print(unit.target_temperature)
print(unit.filter_hours)
print(unit.operation)
print(unit.fan_speed)
print(unit.heat_recovery)
print(unit.heating)
print(unit.heater_enabled)
await unit.set_fan_speed(3)
await unit.set_temp(11)
finally:
unit.close()
asyncio.run(main())See example.py for a more complete example.