Skip to main content

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; call await 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 as client.current_temp, client.current_setpoint, client.mode, client.heating, etc.
  • await async_fetch_data() returns the merged dict of 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:

  • AtagConnectException when the HTTP endpoint cannot be reached or times out.
  • AtagStatusException when the thermostat rejects a read/write.
  • AtagNotPaired / AtagInvalidResponse for malformed or unauthorised exchanges.

Wrap calls in try/except blocks or retry loops as needed in your automation.

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

pyatagone-1.0.12.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyatagone-1.0.12-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file pyatagone-1.0.12.tar.gz.

File metadata

  • Download URL: pyatagone-1.0.12.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

Hashes for pyatagone-1.0.12.tar.gz
Algorithm Hash digest
SHA256 e6601402be780ce5aebb8b65dff2b8e850ec1d456355e6dc19868a37c9e7e0ee
MD5 c298e529efc3ffc56cfe5cdce4e23ef1
BLAKE2b-256 4f9fccda3a388babd681af686639416a10bb88245aaa2b03cbafc1a6880681b1

See more details on using hashes here.

File details

Details for the file pyatagone-1.0.12-py3-none-any.whl.

File metadata

  • Download URL: pyatagone-1.0.12-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

Hashes for pyatagone-1.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 28022387780e16d5902a9c43a0cb2262197ee9e76a15b68bd38de0a95445f617
MD5 c920bea3ebe615bdad79da0643a4c933
BLAKE2b-256 cda74857d93386a040a62ecff45e64fd478b18fdd643e324747526d8c434db4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page