feat(domains): add Humidifier domain (#38)#65
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #38.
Issue assessment
Valid feature request. The
humidifierdomain was the only HVAC-adjacentHome 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.pywith:is_on,target_humidity,current_humidity,mode,available_modes,device_class.on(),off(),toggle(),set_humidity(value),set_mode(mode).set_humidityvalidates the 0-100 range.on_turn_on,on_turn_off,on_humidity_change,on_mode_change.set_modeis a no-op when the devicereports no
available_modes, and raisesValueErrorfor unknownmodes when it does.
current_humidity,target_humidity,mode,and
device_classall returnNonewhen unreported.Registered via the standard
DomainSpecplugin mechanism, soclient.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).