Skip to content

feat(domains): add Humidifier domain (#38)#65

Merged
Faerkeren merged 1 commit into
mainfrom
feat/humidifier-domain
May 26, 2026
Merged

feat(domains): add Humidifier domain (#38)#65
Faerkeren merged 1 commit into
mainfrom
feat/humidifier-domain

Conversation

@Faerkeren

Copy link
Copy Markdown
Contributor

Closes #38.

Issue assessment

Valid feature request. The humidifier domain was the only HVAC-adjacent
Home Assistant domain without a typed wrapper. Adding it is consistent
with existing domains (Climate, Switch, Cover, Valve, Lock) and the
project's core mission of providing an intuitive, Pythonic abstraction
over HA's raw services.

Fix

New src/haclient/domains/humidifier.py with:

  • State properties: is_on, target_humidity, current_humidity,
    mode, available_modes, device_class.
  • Actions: on(), off(), toggle(), set_humidity(value),
    set_mode(mode). set_humidity validates the 0-100 range.
  • Listeners: on_turn_on, on_turn_off, on_humidity_change,
    on_mode_change.
  • Graceful degradation: set_mode is a no-op when the device
    reports no available_modes, and raises ValueError for unknown
    modes when it does. current_humidity, target_humidity, mode,
    and device_class all return None when unreported.

Registered via the standard DomainSpec plugin mechanism, so
client.humidifier("bedroom") works automatically.

Checks run

  • pytest tests/ --cov=haclient --cov-fail-under=95 — 260 passed,
    total coverage 96.52% (humidifier module 100%).
  • ruff check src tests — clean.
  • ruff format --check src tests — clean.
  • mypy src — clean (strict mode, 33 source files).

Adds typed Humidifier domain helper exposing intent-specific methods
(on/off/toggle, set_humidity, set_mode) and state properties
(is_on, target_humidity, current_humidity, mode, available_modes).

set_mode degrades safely: it is a no-op for devices that do not
report any available_modes, and raises ValueError for modes outside
the reported set. current_humidity returns None when unreported.
@Faerkeren Faerkeren merged commit f7f6289 into main May 26, 2026
12 checks passed
@Faerkeren Faerkeren deleted the feat/humidifier-domain branch May 26, 2026 18:39
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.

[Feature]: Add Humidifier domain support

1 participant