NEW] Control Flair Vents with Hubitat - Free Open Source App and Driver

Here’s a concise rundown of what landed in the Beta branch, broken into major areas of change:

1. Multi-Instance Support

2. Constants & Configuration Cleanup

  • Introduced a clear Constants section with static final fields, replacing the earlier loose @Field declarations.
  • Renamed and standardized constant names (e.g. TEMP_READINGS_DELAY_MS, MIN_COMBINED_VENT_FLOW, INCREMENT_PERCENTAGE) for clarity.
  • Added new timing constants (INITIALIZATION_DELAY_MS, POST_STATE_CHANGE_DELAY_MS) and a default open for standard vents (STANDARD_VENT_DEFAULT_OPEN).

3. New “Vent Options” UI

  • Added a Vent Adjustment Granularity setting (ventGranularity) allowing you to choose 5%, 10%, 25%, 50% or 100% steps.
  • Moved debug controls into a Debug Options section.

4. OAuth & Async HTTP Refinements

  • Renamed and hardened the OAuth flow: autheticate()authenticate(), added better error-handling when tokens fail.
  • Switched both getDataAsync and patchDataAsync to accept a callback name string and introduced a noOpHandler for fire-and-forget patches.

5. Logging & Diagnostics

  • Split logging into two helpers:
    • log(String msg, int level) respects your debug level.
    • logDetails(String msg, details, int level) for structured payloads.
  • Cleaned up log messages for consistency and readability.

6. Core Algorithm Tweaks

  • Renamed functions to be more descriptive (e.g. roundToNearestMultiple, calculateVentOpenPercentage).
  • Swapped all manual loops (for, if checks) for Groovy-style each with lambda closures.
  • Enforced strict typing in helpers (BigDecimal getRoomTemp(def vent), Map signatures, etc.).
  • Improved temperature read logic: if you haven’t assigned a custom thermostat to a vent, it now falls back on the Flair puck’s “room-current-temperature-c.”

7. UI Table Polish

  • Overhauled the “Discovered Devices” table with updated CSS, clearer column headings, and consolidated efficiency badge logic into a single loop.

These tweaks are all in the Beta branch here:

https://github.com/ljbotero/hubitat-flair-vents/blob/Beta/src/hubitat-flair-vents-app.groovy

Feel free to grab that raw code, paste it into Apps Code, Save, and test. Any issues—bugs or feedback—can be filed on GitHub under Issues. Cheers!

1 Like