fix: Antminer S19K Pro - HEM/Sleep power mode select + wake-from-sleep#588
Open
erwindr67 wants to merge 1 commit into
Open
fix: Antminer S19K Pro - HEM/Sleep power mode select + wake-from-sleep#588erwindr67 wants to merge 1 commit into
erwindr67 wants to merge 1 commit into
Conversation
- 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>
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.
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
activeswitch 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), soresume_mining()is not sufficient. The power mode dropdown also offeredHighandLowoptions that do not map to valid firmware modes.Changes
select.py: Replaced
[Normal, High, Low]with[Normal, Sleep, HEM]. Sleep usesMiningModeSleep(miner-mode 1). HEM uses a localMiningModeHEMsubclass (miner-mode 2) since pyasic has no native class for this;MiningModeHPMincorrectly sends miner-mode 0.switch.py: Capture and persist active mining mode across HA restarts. Wake miner via
send_config()with stored mode instead ofresume_mining(). Fallback toresume_mining()whensend_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
wow....Claude code did this. Couldn't have done it better!