Skip to content

fix: Antminer S19K Pro - HEM/Sleep power mode select + wake-from-sleep#588

Open
erwindr67 wants to merge 1 commit into
Schnitzel:mainfrom
erwindr67:fix/s19kpro-hem-sleep-ha2026.3
Open

fix: Antminer S19K Pro - HEM/Sleep power mode select + wake-from-sleep#588
erwindr67 wants to merge 1 commit into
Schnitzel:mainfrom
erwindr67:fix/s19kpro-hem-sleep-ha2026.3

Conversation

@erwindr67

@erwindr67 erwindr67 commented Mar 23, 2026

Copy link
Copy Markdown

Summary

Tested on: Antminer S19K Pro 120TH/s (firmware FR-1.17(250624-S19kPro)), Bitaxe Gamma (BM1370), Home Assistant OS 17.1 / Core 2026.3.2.

Problem

The active switch could put the S19K Pro into sleep mode but could not wake it back up. The S19K Pro has three power states (Sleep / Normal / HEM), so resume_mining() is not sufficient. The power mode dropdown also offered High and Low options that do not map to valid firmware modes.

Changes

select.py: Replaced [Normal, High, Low] with [Normal, Sleep, HEM]. Sleep uses MiningModeSleep (miner-mode 1). HEM uses a local MiningModeHEM subclass (miner-mode 2) since pyasic has no native class for this; MiningModeHPM incorrectly sends miner-mode 0.

switch.py: Capture and persist active mining mode across HA restarts. Wake miner via send_config() with stored mode instead of resume_mining(). Fallback to resume_mining() when send_config() fails. Preserve stored mode across failed stop attempts.

coordinator.py, config_flow.py, patch.py, etc.: Lazy imports for Python 3.12 compatibility (HA 2026.3.x).

Test plan

  • Active OFF -> sleep, Active ON -> resumes previous mode
  • Dropdown: Normal=mode 0, Sleep=mode 1, HEM=mode 2
  • HA restart while in HEM -> wake-up restores HEM

wow....Claude code did this. Couldn't have done it better!

- select.py: replace Non-functional High/Low options with Sleep (miner-mode 1)
  and HEM (miner-mode 2) for Antminer S19K Pro firmware FR-1.17.
  Adds local MiningModeHEM subclass since pyasic has no native mode-2 class.
- switch.py: fix wake-from-sleep for S19K Pro; store and restore mining mode
  (Normal/HEM) across sleep cycles and HA restarts using send_config()
  with fallback to resume_mining().
- coordinator.py, config_flow.py, patch.py, etc.: lazy imports and other
  changes for Python 3.12 compatibility required by HA 2026.3.x.

Tested on: Antminer S19K Pro 120TH/s (firmware FR-1.17(250624-S19kPro)),
Bitaxe Gamma (BM1370), Home Assistant OS 17.1 / Core 2026.3.2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant