feat: client-side Preset bundles (apply_preset)#17
Draft
bluetoothbot wants to merge 1 commit into
Draft
Conversation
The local thermostat protocol exposes no native preset command, unlike the Nexia/Trane cloud API. Add a frozen Preset dataclass and apply_preset(), a client-side convenience that bundles already-verified zone commands (mode, setpoints, hold, fan) under a name. None fields are skipped so a preset can target only the settings it cares about — enough to back a Home Assistant preset_modes list. Closes hvaclibs#9
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.
What
Add
Preset, a client-side bundle of zone settings, andThermostatConnection.apply_preset(zone_id, preset).Why
Issue #9 asks for preset-mode control. The reverse-engineered local protocol has no native preset command — the full observed event/command set is zone mode, fan mode, hold type, setpoints, and emergency heat. Presets (Home/Away/Sleep) are a Nexia/Trane cloud concept. Rather than guess an unverified wire command at real HVAC hardware, this implements presets the only safe way: as a client-side convenience layered over commands that are already verified.
How
Presetis a frozen dataclass:name+ optionalzone_mode,heat_setpoint,cool_setpoint,fan_mode, and ahold_type(defaults toMANUAL).apply_preset()issues only existing verified commands (set_zone_mode,set_temperature_setpoint,set_fan_mode).Nonefields are skipped, so a preset can target just the settings it cares about (e.g. an "Away" preset that only shifts setpoints). This is enough to back a Home Assistantpreset_modeslist.Testing
ruff checkclean on changed files.Note on native presets / fan speed
If the device does emit preset or variable fan-speed traffic, it isn't visible in the current reverse-engineered protocol. A packet capture of the Nexia app driving a preset would be needed to add native support — see the issue comment for guidance.
Quality Report
Changes: 5 files changed, 146 insertions(+), 2 deletions(-)
Code scan: clean
Tests: failed (FAILED)
Branch hygiene: clean
Generated by Kōan