Skip to main content

Comfort Advisor

A dependency-free Python library for psychrometric comfort evaluation and natural ventilation advice, extracted from Home Assistant Comfort Advisor. No Home Assistant installation is required. The initial release preserves the existing algorithm; adaptive indoor prediction is future work.

Installation

pip install comfort-advisor

Example

from datetime import UTC, datetime, timedelta
from comfort_advisor import ComfortCalculator, Input, Calculated, US_CUSTOMARY_SYSTEM

now = datetime.now(UTC)
calculator = ComfortCalculator(US_CUSTOMARY_SYSTEM, {
    "temperature_unit": "°F",
    "simmer_index_min": 70,
    "simmer_index_max": 85,
    "dew_point_max": 60,
    "humidity_max": 95,
    "pollen_max": 2,
}, clock=lambda: now)
calculator.set_input(Input.INDOOR_TEMPERATURE, 77)
calculator.set_input(Input.INDOOR_HUMIDITY, 50)
calculator.set_input(Input.OUTDOOR_TEMPERATURE, 70)
calculator.set_input(Input.OUTDOOR_HUMIDITY, 50)
calculator.set_input(Input.FORECAST, [
    {"datetime": (now + timedelta(hours=i)).isoformat(),
     "temperature": 70 + i, "humidity": 50}
    for i in range(1, 25)
])
calculator.recalculate()
print(calculator.get_calculated(Calculated.CAN_OPEN_WINDOWS))
print(calculator.extra_attributes)
print(calculator.get_calculated(Calculated.CLOSE_WINDOWS_AT))

API

Use METRIC_SYSTEM for Celsius or US_CUSTOMARY_SYSTEM for Fahrenheit. Configuration temperatures are expressed in the declared temperature_unit; observations and forecasts use the selected unit system. Humidity is a percentage; enthalpy is kJ/kg dry air. Forecasts must be chronological, with timezone-aware ISO timestamps, temperature and humidity, and optional dew point. Supply current observations independently from forecast entries. The optional clock callable returns an aware datetime and can be advanced in replay tests; the default clock uses UTC.

Call set_input with None to mark a required input unavailable. recalculate() returns whether outputs have been refreshed or cleared; available indicates usable calculated outputs. expires_at identifies the next forecast boundary at which callers should refresh. get_calculated() accepts Calculated values; extra_attributes includes the advice reason. update_pollen() accepts a normalized level 0–5 or None. pollen_level() converts common named levels or IQVIA values. The caller owns scheduling, state subscriptions, persistence and actions. The library never controls equipment.

Optional configuration keys: cooling_temperature_min (default 60°F), temperature_tolerance (2°F difference), hysteresis (1°F difference), humidity_hysteresis (2 percentage points). Defaults convert to the selected unit. The initial algorithm uses previous advice for hysteresis, not actual contact sensor state, and compares forecast hours with current indoor conditions.

The comfort_advisor.formulas module exposes the original psychrometric functions, including saturation pressure, dew point, relative humidity, summer simmer index and moist-air enthalpy. See function docstrings for units.

Development and release

python -m venv .venv
source .venv/bin/activate
python -m pip install -e '.[dev]'
python -m pytest
python -m build
python -m twine check dist/*

See RELEASING.md for GitHub and PyPI setup. The library retains the upstream AGPL-3.0-or-later license; consumers must evaluate compatibility before distribution. No license change is implied by extraction.

Metadata

Release files for comfort-advisor 0.1.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 comfort-advisor 0.1.1
File Size Uploaded Provenance Actions
comfort_advisor-0.1.1.tar.gz 39.2 kB With provenance Details for comfort_advisor-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for comfort-advisor 0.1.1
File Interpreter ABI Platform Actions
comfort_advisor-0.1.1-py3-none-any.whl Python 3 none any Details for comfort_advisor-0.1.1-py3-none-any.whl

Total release size: 65.9 kB

Release files / comfort_advisor-0.1.1.tar.gz

Download URL comfort_advisor-0.1.1.tar.gz
Size 39.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1073bef38efbf33f7be30daedde6a5cd67d7cb9d975765d0a3a9df232a87dc19
BLAKE2b-256 checksum
How to use checksums
527ac547b0ba77ef6171e932e03fad15d85053a0149c625e260612f1cb325355
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 28, 2026.

Transparency log

Release files / comfort_advisor-0.1.1-py3-none-any.whl

Download URL comfort_advisor-0.1.1-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7711d549a7fd5e18cd48a3207f186431db643911be053a21638926bbbf2ee76f
BLAKE2b-256 checksum
How to use checksums
2c3a7e21c5bc4ec16b4178812a436c14aa8921ceb1d4a62f740dbf75ac435443
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 28, 2026.

Transparency log

Security for comfort-advisor 0.1.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 comfort_advisor-0.1.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 28, 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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