Add support for UWG5#686
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #686 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 9 10 +1
Lines 354 521 +167
Branches 55 67 +12
==========================================
+ Hits 354 521 +167 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Owner
|
I will try testing this version with my own thermostat within the next few days, see if everything still works. |
Owner
|
I can confirm that testing this with my thermostat still works, will merge this :) |
Owner
|
Released as v3.4.0, thanks! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Add WG5-series thermostat support and refactor the API abstraction layer.
WG5 support
Supported features:
identity.ojmicroline.comNew
Thermostatfields (all optional, WG5-only):building_id,zone_uuid,is_in_standby,schedule_id,schedule_name.Architectural changes
The
OJMicrolineAPIProtocol has been redesigned from a data-oriented contract (paths, body builders, response parsers) to a behavior-oriented contract. This is a breaking change for any customOJMicrolineAPIimplementations.Why
The old Protocol assumed all APIs follow the same request pattern: POST to a login path, GET from a thermostats path with a session ID, parse the response. WG5 doesn't work that way — it uses OAuth2 Bearer tokens instead of session IDs, requires multiple chained requests per thermostat (control → detail → schedule), and manages building-level away mode as a separate resource. The old abstraction couldn't accommodate this without forcing WG5 into a session-shaped hole.
By moving the full request lifecycle into the API implementations, each API owns its auth and request flow end-to-end. WD5 and WG4 keep their session-based pattern via
SessionOJMicrolineAPI, while WG5 implements the Protocol directly with its own OAuth2 flow.What changed
login_path,login_body(),get_thermostats_path,parse_thermostats_response(), etc.login(),get_thermostats(),get_energy_usage(),set_regulation_mode()SessionOJMicrolineAPI— new base class that extracts the session-based login/request logic previously inOJMicroline. WD5API and WG4API extend this, preserving their existing behavior. Session state (_session_id,_session_calls_left) now lives on the API object rather than onOJMicroline.OJMicroline— now a thin wrapper that delegates to the API object and manages the HTTP session/timeout. Its public interface (login,get_thermostats,get_energy_usage,set_regulation_mode,close) is unchanged._request— now accepts aheadersparameter, enabling WG5's Bearer token auth alongside the existing session-based auth.Test plan
🤖 Generated with Claude Code