AtagOne API wrapper
Project description
pyatagone
a Python interface for the ATAG One Thermostat
Installation
[sudo] pip install pyatagone
Usage
Module
You can import the module as pyatagone
Quick start
import asyncio
from pyatagone import AtagOne, AtagConnectException
async def main():
client = AtagOne(host="192.168.1.42") # use async_discover() if you do not know the IP
try:
await client.async_pair_atag() # confirm the pairing request on the thermostat
await client.async_update() # populate .data/.sensors
print(client.current_temp, client.current_setpoint)
sensors = await client.async_fetch_data()
print(f"Room temp: {sensors['room_temp']} °C")
except AtagConnectException as exc:
print(f"Could not reach thermostat: {exc}")
asyncio.run(main())
Discovery and pairing
AtagOne(host=None, port=10000)expects the IP address of the thermostat; callawait async_discover()to let the library broadcast on the LAN and remember the responding host.- Call
await async_pair_atag()once and confirm the pairing request on the ATAG One screen; the client caches the pairing state in memory for the current process.
Reading live data
await async_update()refreshes every section (report, control, schedules, configuration). After that you can read rich helpers such asclient.current_temp,client.current_setpoint,client.mode,client.heating, etc.await async_fetch_data()returns the mergeddictof all sensors (report + control + derived values) so you can serialise or expose it directly.- Individual sections are available through
.reportdata,.controldata,.scheduledata,.configurationdata, and.sensors.
Writing values
Most operations are simple helpers that wrap send_dynamic_change() behind the scenes:
await client.async_set_temperature(21.5) # validates DEFAULT_MIN/MAX_TEMP
await client.async_ch_mode(2) # switch preset (manual/auto)
await client.async_ch_control_mode(1) # on/off
await client.async_dhw_temp_setp(60.0) # domestic hot water
await client.async_create_vacation(start_epoch, 18.0, duration_seconds)
await client.async_room_temp_offs(-0.5) # calibration
await client.async_summer_eco_mode(1) # enable summer eco
Refer to pyatagone/client.py for the full list of helpers (CH/DHW schedule uploads, vacation control, eco settings, offsets, etc.). Every helper returns True when the thermostat acknowledged the update and raises AtagStatusException if the unit refused the change.
Working with schedules
Schedules use the Schedule dataclass from pyatagone.atagonejson. Each schedule has a base_temp plus a 7-day entries matrix (day → list of [seconds_since_midnight, temperature] pairs). Upload schedules with async_ch_schedule or async_dhw_schedule.
from pyatagone import AtagOne
from pyatagone.atagonejson import Schedule
weekday = [
[0, 18.0], # midnight-06:00
[6 * 3600, 21.0], # wake-up
[22 * 3600, 17.0], # night setback
]
weekend = [
[0, 20.0],
]
schedule = Schedule(base_temp=17.0, entries=[weekday, weekday, weekday, weekday, weekday, weekend, weekend])
await client.async_ch_schedule(schedule)
You can modify the current schedule in-place by editing client.chscheduledata / client.dhwscheduledata and then calling async_ch_schedule_base_temp or async_dhw_schedule_base_temp.
Error handling
Operations raise:
AtagConnectExceptionwhen the HTTP endpoint cannot be reached or times out.AtagStatusExceptionwhen the thermostat rejects a read/write.AtagNotPaired/AtagInvalidResponsefor malformed or unauthorised exchanges.
Wrap calls in try/except blocks or retry loops as needed in your automation.
Project details
Release history Release notifications | RSS feed
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 pyatagone-1.0.11.tar.gz.
File metadata
- Download URL: pyatagone-1.0.11.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56f24e360fbf08cbe5bf119a4c3b5d764ad88c1faff66a192ccfb68071521a8b
|
|
| MD5 |
47f73856edae0a863766e177fda3d3bd
|
|
| BLAKE2b-256 |
b8ddb1f1ff619e4c6facbe18eec3073a32dd111fc1e97d9fced1af8be7b9247c
|
File details
Details for the file pyatagone-1.0.11-py3-none-any.whl.
File metadata
- Download URL: pyatagone-1.0.11-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
356eb096db89076d105deb53d41c49a4f709569e0a71e15ff5190a8d6e10143c
|
|
| MD5 |
4712659948e8fcdba4972dc851f1eb36
|
|
| BLAKE2b-256 |
13d558069a5a76dd993be0494f9f49bf826fb6dfd24336ecb1aa3724d17068f8
|