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.update_input(Input.INDOOR_TEMPERATURE, 77)
calculator.update_input(Input.INDOOR_HUMIDITY, 50)
calculator.update_input(Input.OUTDOOR_TEMPERATURE, 70)
calculator.update_input(Input.OUTDOOR_HUMIDITY, 50)
calculator.update_input(Input.FORECAST, [
{"datetime": (now + timedelta(hours=i)).isoformat(),
"temperature": 70 + i, "humidity": 50}
for i in range(1, 25)
])
calculator.refresh_state()
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 update_input with None to mark a required input unavailable. refresh_state() 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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| comfort_advisor-0.1.0.tar.gz | 39.3 kB | With provenance | Details for comfort_advisor-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| comfort_advisor-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for comfort_advisor-0.1.0-py3-none-any.whl |
Total release size: 66.0 kB
Release files / comfort_advisor-0.1.0.tar.gz
| Download URL | comfort_advisor-0.1.0.tar.gz |
|---|---|
| Size | 39.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
118a063bf72dfd2a4f6519225df188bc8efc22bfdefc8a4ae051bd3912a5c7f7
|
|
BLAKE2b-256 checksum How to use checksums |
e5b40570f9837cf32b2378185a07479e03207eadc81f9156376475c801dc3fda
|
| 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 27, 2026.
Transparency logRelease files / comfort_advisor-0.1.0-py3-none-any.whl
| Download URL | comfort_advisor-0.1.0-py3-none-any.whl |
|---|---|
| Size | 26.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb6605a101f133152825311e50ce92c79f47e62abb3c6ea2886382231c6bbcd9
|
|
BLAKE2b-256 checksum How to use checksums |
cd3cda84a09510d46c595222b2e4ae4824fb17df43c670bf25e02844b147d6cd
|
| 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 27, 2026.
Transparency logSecurity for comfort-advisor 0.1.0
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.
Attestation for comfort_advisor-0.1.0.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 27, 2026.
Transparency logA 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.