Skip to main content

PyPI

Local Ecobee Control (HomeKit)

Control your Ecobee thermostat from Python over your local network, with no cloud, no OAuth, no ecobee developer key, and no Home Assistant. It talks to the thermostat directly using Apple's HomeKit Accessory Protocol (HAP) via aiohomekit.

Pair once, then read and control the thermostat from a small control-panel GUI, a command line, or as a Python library you drop into your own project.

Works with any HomeKit-capable Ecobee. Developed and tested against an Ecobee3 lite and an Ecobee Smart Premium (including its remote SmartSensor).

What it can do

  • Read current temperature, target, mode, running state, humidity, and fan state
  • Set target temperature, mode (heat / cool / auto / off), heat/cool thresholds, and fan (auto / on)
  • Read remote SmartSensors and the built-in occupancy sensor (temperature, occupancy, battery)
  • Set target humidity on models that have a humidifier/dehumidifier (e.g. Smart Premium)
  • Read and switch comfort profiles (Home / Sleep / Away) locally on supported models (see notes; the ecobee3 lite does not support this correctly)
  • Fahrenheit or Celsius display, with exact half-degree Celsius setting
  • A live GUI that auto-updates, or a scriptable CLI, or an importable library

Install

pip install ecobee-local

Or clone this repo and pip install . to build the exact package that's published to PyPI.

Requirements

  • Python 3.10+
  • Dependencies aiohomekit and zeroconf (installed automatically by pip, or via pip install -r requirements.txt)
  • Tkinter for the GUI. It ships with Python on Windows and macOS. On some Linux distros it's a separate package: sudo apt install python3-tk.

Setup

1. Free the thermostat for pairing

HomeKit accessories can only be paired to one "home" at a time. If your Ecobee is already added to Apple Home, it won't be discoverable for pairing until you reset its HomeKit info. On the thermostat: Menu → Settings → HomeKit → Reset HomeKit. (This removes it from Apple Home. If you don't use Apple Home, there's nothing to do.)

2. Pair

ecobee-pair

(Cloned the repo instead of installing? Use python -m ecobee_local.pair.)

The wizard will:

  • scan your network and show a numbered list of HomeKit devices (or filter by name),
  • let you pick the thermostat, give it a short label and a friendly name,
  • ask for the 8-digit HomeKit setup code shown on the thermostat screen (type it any way: 12345678, 1234 5678, or 123-45-678 all work),
  • save the credentials to a file.

Run it again for each additional thermostat. Files are saved to a per-user folder (%LOCALAPPDATA%\ecobee-local on Windows, ~/ecobee-local on macOS/Linux) by default; use --folder PATH to change it.

Keep your pairing files private. Each one contains long-term keys that grant full control of that thermostat on your network. Don't commit or share them. ecobee-pair saves them readable only by you. The included .gitignore excludes the default names (pair.json, pair1.json, ...); if you save one under another name inside a git repo, add it to .gitignore yourself.

3. Run

ecobee-hub

(Cloned instead of installed? Use python -m ecobee_local.controller.)

With no arguments this opens the control window (one card per thermostat). On a headless machine with no display it automatically falls back to a background service instead.

Command line

Everything the GUI does is also scriptable. All --set-* actions require --label.

ecobee-hub                                            # open the GUI
ecobee-hub --status                                   # print every thermostat's status and exit
ecobee-hub --status --label main                      # just one
ecobee-hub --watch                                    # print a line whenever something changes
ecobee-hub --dump                                     # list every characteristic each thermostat exposes
ecobee-hub --dump --raw                               # same, without truncating long values
ecobee-hub --label main --set-temp 72
ecobee-hub --label main --set-temp-c 22.5             # Celsius (also --set-heat-c, --set-cool-c)
ecobee-hub --label main --set-mode cool               # off/heat/cool/auto (or 0-3)
ecobee-hub --label main --set-heat 68 --set-cool 75   # auto-mode range
ecobee-hub --label main --set-range 68 75             # both thresholds in one request
ecobee-hub --label main --set-fan on
ecobee-hub --label main --set-comfort away            # home/sleep/away/hold (supported models)
ecobee-hub --label main --set-humidity 40             # target humidity (models with a humidifier)
ecobee-hub --headless                                 # run as a background service (no GUI)
ecobee-hub --debug                                    # print connection/subscription events
ecobee-hub --folder PATH                              # use a different credentials folder

(If you cloned rather than installed, replace ecobee-hub with python -m ecobee_local.controller.)

--folder can point at a folder that has other JSON files too (for example your own app's folder): only files that hold HomeKit pairings are used.

--dump is the tool for discovering what your specific model exposes: it prints every characteristic of every accessory with its UUID, description, current value, permissions, and the range and valid values the thermostat publishes. It can't be combined with --set-*, --status, --watch or --headless.

Exit codes: 0 when everything worked, 1 when a --set-* failed, a thermostat couldn't be dumped, or there are no pairing files for what you asked, and 2 for a usage mistake like a missing or unknown --label. A one-shot --set-* run prints the status of every thermostat afterwards, not only the --label one.

Use it as a library

from ecobee_local import EcobeeController

ec = EcobeeController.from_folder()   # auto-discovers every pairing file
ec.start()
ec.wait_ready()                       # wait for the first readings (optional)

print(ec.get_status("main"))
# {'current_temp': 78, 'target_temp': 75, 'mode': 2, 'humidity': 57,
#  'setpoint_kind': 'single', 'display_target': 75, 'sensors': [...], ...}

ec.set_temp("main", 72)                       # Fahrenheit
ec.set_temp_c("main", 22.5)                   # Celsius, exact half-degree
ec.set_mode("main", EcobeeController.MODE_COOL)
ec.set_heat_threshold("main", 68)             # auto mode
ec.set_cool_threshold("main", 75)
ec.set_range("main", 68, 75)                  # both at once, returns what was kept
ec.set_fan("main", auto=True)

# comfort profiles (works on some models, not the ecobee3 lite; see notes)
print(ec.get_comfort_mode("main"))            # "home" / "sleep" / "away" / "hold"
ec.set_comfort_mode("main", "away")           # switch locally, no cloud
# the first comfort call prints a one-time firmware-caveat note to stderr;
# construct EcobeeController(..., comfort_warning=False) to silence it

ec.stop()                                     # cleanly close connections

Or let a with block start it, wait for the first readings, and always close the connections at the end, even if your code raises an error:

with EcobeeController.from_folder() as ec:
    ec.set_temp("main", 72)

To react to changes as they happen (from the thermostat, the ecobee app, a schedule, a sensor, or your own commands) instead of polling:

def changed(label, status):
    print(label, status["current_temp"], status["target_temp"])

remove = ec.on_change(changed)   # call remove() to stop

Callbacks run on the controller's background thread: keep them quick, and don't call the controller's commands (set_temp etc.) from inside one. Those return an error there; hand the work to another thread instead.

get_status() returns a dict per thermostat (get_status("main") for one; an unknown label raises KeyError). Each is an independent copy, so changing it doesn't affect the controller. Besides the readings, it has:

  • setpoint_kind: "single" in heat/cool/off and "range" in auto.
  • display_target: the value(s) a UI should show: one number in single-setpoint modes, {"heat": ..., "cool": ...} in auto.
  • In auto mode target_temp is None, because a single target is meaningless there - the thermostat runs off the heat/cool thresholds. Read heat_threshold / cool_threshold (or display_target) instead.
  • Temperatures are in Fahrenheit; the raw Celsius the device reports is also included as *_c (e.g. target_temp_c).
  • Fields a given model doesn't support, or that haven't been read yet, are "--" rather than a misleading 0 (None for the *_c fields, limits entries and sensor fields).
  • modes: the modes this thermostat may be set to, in order, e.g. ["off", "heat", "cool"]. It's the list you configured (see Choosing which modes are allowed), or else what the thermostat publishes over HomeKit, re-read on every reconnect; if it publishes nothing usable, all four. None until the first connection, unless you configured it. set_mode() refuses a mode that isn't listed ("auto mode is turned off on this thermostat"). Tested on real Ecobees: they publish all four modes whether or not Auto Heat/Cool is enabled on the thermostat, and accept auto over HomeKit even when it's disabled, so on an Ecobee configure modes yourself if that matters.
  • limits: the allowed [min, max] for target, heat_threshold and cool_threshold in Fahrenheit (limits_c in Celsius), as published by the thermostat; None where it publishes no usable range.
  • offline_reason: why a thermostat is offline. "unpaired" when it no longer accepts our pairing (HomeKit was reset on it, it was re-paired elsewhere, or the pairing file is missing or broken), so re-pairing is the fix; "unreachable" when it just doesn't answer (network, power). None while online, before the first connection attempt, and after stop().
  • updated_at: when the last reading arrived from that thermostat (epoch seconds, None before the first one), so you can spot stale data. A new reading with nothing else changed doesn't trigger on_change.

Other methods, in short (setters return {"ok": True} or {"ok": False, "error": ...} and never raise for bad input or an unknown label):

Method What it does
set_heat_threshold_c(), set_cool_threshold_c() thresholds in Celsius
set_target_humidity(label, percent) target humidity, 0-100 (models with a humidifier/dehumidifier)
set_display_units(label, fahrenheit) units shown on the thermostat itself (True for °F)
refresh(label) read the thermostat now instead of waiting for the next update
list_thermostats() [{"label", "name", "online"}, ...]
add_thermostat(filename, label=None, name=None, modes=None) add one more pairing file before start()
dump_characteristics(label) everything the thermostat exposes, as a list of dicts (or an error dict)
EcobeeController.from_folder(app_folder=None, pattern="*.json", ...) every pairing file in a folder; pattern narrows it

stop() closes the connections; commands still running get {"ok": False, "error": "controller stopped"}. From inside an on_change callback, commands return an error and stop() raises RuntimeError (both would otherwise freeze the controller's thread).

Choosing which modes are allowed

Because an Ecobee doesn't report its Auto Heat/Cool setting over HomeKit (and accepts auto anyway), you can declare the allowed modes per thermostat. get_status()["modes"], set_mode() (which then refuses the others), --status and the control window all follow it. Either pass them to the constructor:

ec = EcobeeController(
    pair_files={"main": "pair.json", "up": "pair1.json"},
    modes={"main": ["off", "heat", "cool"]},   # no auto on this one
)

(from_folder(..., modes={...}) takes the same argument.) Or add a "_modes" key to that thermostat's pairing file, next to "_label" and "_name":

"_modes": ["off", "heat", "cool"]

If both are set, the constructor wins. Without either, the thermostat's own HomeKit list is used. If the thermostat publishes a narrower list than yours, only modes in both are allowed, and if none are left, a warning is printed (and no mode can be set). An unknown mode name or label in modes= raises ValueError; an invalid "_modes" in a file is ignored with a warning.

Re-pairing caveat: "_modes" lives in the pairing file, so anything that rewrites that file when a thermostat is re-paired can silently drop it. ecobee-pair keeps it when you re-pair over the same file, but other tools may not. If your own program rewrites pairing files, pass modes= to the constructor instead.

Heat/cool thresholds on an Ecobee

set_range() writes both auto-mode thresholds in one request and returns the values the thermostat kept. Tested on real Ecobees: they accept any gap over HomeKit, even heat 75°F / cool 76°F (0.5°C apart) in auto mode, without rejecting it or moving either threshold, and both read back unchanged afterwards. So the library doesn't enforce a minimum gap either; if you want one, check it before calling set_range().

How it works

ecobee_local/pair.py performs the one-time HomeKit handshake and saves credentials. ecobee_local/controller.py uses those credentials to keep a persistent local connection per thermostat, subscribes for push updates (the device notifies it on change), and caches readings so the GUI/CLI never block on the network. Characteristics are located by their standard HomeKit type inside the thermostat's Thermostat service, so the same code works across different Ecobee models without hardcoding.

Notes and limitations

  • This is local HomeKit control. It reads and controls whatever the thermostat exposes over HomeKit.
  • Air quality is not available. The Smart Premium has an air-quality sensor, but Ecobee does not publish air quality (VOC / CO₂) over HomeKit - only through their cloud. So no local tool, including this one, Apple Home, or Home Assistant, can read it over HomeKit.
  • The Ecobee app and HomeKit can briefly disagree. Ecobee drives its own screen and app from its cloud/comfort-profile system. If you change settings in the ecobee app, the standard HomeKit state this tool reads may show a different or stale value (for example, showing "Auto" with an odd range) until the setting is next changed through HomeKit. Changes made with this tool are always consistent. This is an Ecobee behavior, not a bug in this project.
  • Scheduling isn't a HomeKit feature. HomeKit has no concept of a weekly schedule; Ecobee's comfort schedules live in its own system. You can build time-based automation on top of this library, but it can't read/write Ecobee's schedules over HomeKit.
  • Comfort profiles work on some models, not all. On supported models you can read and switch Home / Sleep / Away locally. This does not work on the ecobee3 lite, which has a known ecobee firmware bug that always reports the same comfort value regardless of the actual setting. For this reason the GUI shows comfort controls but lets you turn them off per-thermostat in Settings. Custom comfort profiles (e.g. a "Gym" profile) aren't individually addressable over HomeKit; they all report as "hold", and you can't create profiles from here (that's an ecobee-app action). The comfort UUIDs are vendor-specific and undocumented by ecobee, but verified on hardware and corroborated by the Home Assistant project.

Optional: MQTT bridge

ecobee_local/mqtt.py is an optional MQTT bridge that mirrors your thermostats onto an MQTT broker, so other tools (Node-RED, dashboards, custom scripts, Home Assistant, etc.) can read state and send commands over MQTT. It's experimental, and it uses this library under the hood.

Install it with the optional mqtt extra (pulls in paho-mqtt), and you'll also need a running MQTT broker such as Mosquitto:

pip install "ecobee-local[mqtt]"
winget install --id=EclipseFoundation.Mosquitto -e   # Windows, if you need a broker

Run it:

ecobee-mqtt                       # broker at localhost:1883
ecobee-mqtt --host 192.168.1.50   # broker elsewhere
ecobee-mqtt --host broker.lan --port 8883 --tls --username me

Options: --host (default localhost), --port (default 1883; brokers usually use 8883 for TLS), --username / --password, --tls and --ca-file PATH (TLS, with the system's or your own CA certificate), --prefix (topic prefix, default ecobee), --interval (seconds between state publishes, default 5), --retain (publish state as retained messages) and --folder (where the pairing files are).

(Cloned instead of installed? pip install ".[mqtt]" from the repo, then python -m ecobee_local.mqtt.)

It publishes, for each thermostat, every --interval seconds:

ecobee/<label>/online           true / false
ecobee/<label>/offline_reason   none / unpaired (needs re-pairing) / unreachable
ecobee/<label>/modes            off,heat,cool   (allowed modes; empty if none)
ecobee/<label>/temperature      78
ecobee/<label>/target           75   ("none" in auto mode: use the thresholds)
ecobee/<label>/mode             off / heat / cool / auto
ecobee/<label>/heat_threshold   68
ecobee/<label>/cool_threshold   75
ecobee/<label>/humidity         57
ecobee/<label>/fan              auto / on
ecobee/<label>/comfort          home / sleep / away / hold
ecobee/<label>/state            everything above (and more) as one JSON object

Readings that haven't arrived yet aren't published (online and offline_reason always are). ecobee/bridge/online is true while the bridge runs and turns false when it stops or loses its connection (a retained last-will message).

It listens for commands on ecobee/<label>/set/<thing>:

ecobee/<label>/set/target     72        (Fahrenheit)
ecobee/<label>/set/target_c   22.5      (Celsius)
ecobee/<label>/set/mode       cool      (off/heat/cool/auto, or 0-3)
ecobee/<label>/set/heat       68        (auto-mode heat threshold, F)
ecobee/<label>/set/cool       75        (auto-mode cool threshold, F)
ecobee/<label>/set/range      68,75     (both thresholds at once, F)
ecobee/<label>/set/fan        auto      (auto/on)
ecobee/<label>/set/humidity   40        (percent)
ecobee/<label>/set/comfort    away      (home/sleep/away/hold)

Commands run one at a time, in the order they arrive. Results are logged by the bridge (errors to stderr). Commands must be sent as normal (not retained) messages; retained ones are ignored, because the broker would replay them every time the bridge reconnects.

If your broker needs a login, use --username and put the password in the ECOBEE_MQTT_PASSWORD environment variable rather than --password, so it doesn't show up in the process list (either one is only used together with --username). Without --tls, MQTT isn't encrypted: anyone who can publish to your broker can control the thermostat, so keep the broker on your own network and require a login if others share it.

Project layout

ecobee_local/
    __init__.py       package entry, exports EcobeeController
    controller.py     the library, CLI, and GUI
    pair.py           the pairing wizard
    mqtt.py           optional MQTT bridge (needs the [mqtt] extra)
tests/                pytest suite (no thermostat or network needed)
pyproject.toml        packaging / build config
requirements.txt      dependencies
LICENSE               MIT

Clone and pip install . to build exactly what's published to PyPI.

Running the tests

The tests need no thermostat, MQTT broker or network:

pip install ".[mqtt]" pytest
pytest

They also run on GitHub for every pull request and push to main. Releases are published to PyPI automatically when a GitHub release is made (see CHANGELOG.md for what changed in each version).

A note on how this was built

The hard part of this project, figuring out how to control an Ecobee locally over HomeKit at all, was months of my own trial and error. The pairing wizard (ecobee_local/pair.py) I wrote entirely myself.

I used AI assistance to help build out and refactor the controller, CLI, and GUI, and to write this README. The core discovery, the debugging direction, the testing on real hardware, and the design calls are mine.

Acknowledgements

Built on aiohomekit, the same HomeKit client that powers Home Assistant's HomeKit Controller integration.

Metadata

Release files for ecobee-local 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ecobee-local 1.3.1
File Size Uploaded Provenance Actions
ecobee_local-1.3.1.tar.gz 102.7 kB With provenance Details for ecobee_local-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ecobee-local 1.3.1
File Interpreter ABI Platform Actions
ecobee_local-1.3.1-py3-none-any.whl Python 3 none any Details for ecobee_local-1.3.1-py3-none-any.whl

Total release size: 158.6 kB

Release files / ecobee_local-1.3.1.tar.gz

Download URL ecobee_local-1.3.1.tar.gz
Size 102.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8193ce2def26772f602fd2dcb52669a62081ccfd835ff5032d6ee2eb23e53b59
BLAKE2b-256 checksum
How to use checksums
12732e6fd57646d9ba35c75348d052474b1351de4af389c11f6f04e6b68551ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / ecobee_local-1.3.1-py3-none-any.whl

Download URL ecobee_local-1.3.1-py3-none-any.whl
Size 55.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d5e334488f6c14a17582abbd3dc6680da982baa6b5be0905fc54f54c444019a
BLAKE2b-256 checksum
How to use checksums
463746a9a1135a72e20608460adcfabc2172e8f6bc4e281e07bfdcc6ed0c6baa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for ecobee-local 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ecobee_local-1.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page