Skip to content

Add power_on and switch_lock to system for Energy Socket v2 API - #641

Merged
lexpostma merged 2 commits into
mainfrom
feature/hw-socket-v2
Nov 19, 2026
Merged

lexpostma merged 2 commits into
mainfrom
feature/hw-socket-v2

Conversation

@lexpostma

Copy link
Copy Markdown
Member

The Energy Socket v2 API (API docs PR homewizard/api-documentation#303) has no /api/state. Instead, power_on and switch_lock are read/write fields on /api/system.

  • Add power_on and switch_lock to System and SystemUpdate, and accept them in system() (base, v1 and v2).
  • v2: send them with PUT /api/system. If the cached device has no switch, raise UnsupportedError instead.
  • v1: route them to /api/v1/state, the same way status_led_brightness_pct already is.
  • CombinedModels copies v1 state.power_on and state.switch_lock onto system, so consumers can read system for both APIs.
  • v2 still has no state(), so combined() doesn't request /api/system twice.
  • Add v2 HWE-SKT fixtures and tests. Most snapshot changes are only the two new System fields.

Not yet tested against real v2 socket hardware: the current socket firmware stops accepting new connections after a few (EMB-1474).

🤖 Generated with Claude Code

lexpostma and others added 2 commits November 19, 2026 14:34
The Energy Socket v2 API exposes power_on and switch_lock on /api/system
instead of a separate state endpoint. Add both fields to System and
SystemUpdate, accept them in system() for v1 and v2, and map the v1 state
onto system in CombinedModels so consumers can use system for both APIs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.28%. Comparing base (eaa93d3) to head (c8ae40d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #641      +/-   ##
==========================================
+ Coverage   99.27%   99.28%   +0.01%     
==========================================
  Files           9        9              
  Lines         685      699      +14     
  Branches       65       70       +5     
==========================================
+ Hits          680      694      +14     
  Misses          2        2              
  Partials        3        3              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DCSBL DCSBL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than a unrelated bump; no remarks


- name: Upload coverage report
uses: codecov/codecov-action@v6.0.1
uses: codecov/codecov-action@v6.0.2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be in a separate PR

@lexpostma
lexpostma merged commit 05db121 into main Nov 19, 2026
33 checks passed
@lexpostma
lexpostma deleted the feature/hw-socket-v2 branch November 19, 2026 14:02
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.

3 participants