Skip to content

fix: has_outdoor_temperature must return bool, not raw JSON value - #222

Draft
bluetoothbot wants to merge 1 commit into
hvaclibs:masterfrom
bluetoothbot:koan/has-outdoor-temperature-bool
Draft

fix: has_outdoor_temperature must return bool, not raw JSON value#222
bluetoothbot wants to merge 1 commit into
hvaclibs:masterfrom
bluetoothbot:koan/has-outdoor-temperature-bool

Conversation

@bluetoothbot

@bluetoothbot bluetoothbot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What: NexiaThermostat.has_outdoor_temperature() now returns a real bool.

Why: It returned the raw thermostat_json value — or None when the key is absent — despite its -> bool annotation. Every sibling capability predicate (has_relative_humidity, has_emergency_heat, has_variable_fan_speed, has_zones, has_dehumidify_support, has_humidify_support, has_air_cleaner) wraps the lookup in bool(); this one was the lone outlier. Since the PEP 561 py.typed marker shipped (#203), the annotation is a downstream contract, so a None return where False is expected is a genuine type-accuracy defect — same class as the int→float setpoint series (#205/#206).

How: Wrap the lookup in bool(...) to match the siblings and the annotation. One-line change.

Testing: Added test_has_outdoor_temperature_returns_bool asserting is False/is True for absent, True, and False JSON. The test fails on the old code (None is False) and passes with the fix. Full suite: 58 passed, 1 skipped; ruff clean.


Quality Report

Changes: 2 files changed, 20 insertions(+), 1 deletion(-)

Code scan: clean

Tests: passed (58 passed)

Branch hygiene: clean

Generated by Kōan

has_outdoor_temperature returned the raw thermostat_json value (or None when
the key is absent), violating its declared -> bool return type. Every sibling
capability predicate (has_relative_humidity, has_emergency_heat, etc.) wraps
the lookup in bool(); this one did not. Since py.typed shipped (hvaclibs#203), the
annotation is a downstream contract, so a None return where False is expected
is a real type-accuracy defect.

Wrap the lookup in bool() to match the siblings and the annotation.
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant