Add set_profile method to LuxOS#409
Open
wilfredallyn wants to merge 6 commits intoUpstreamData:masterfrom
Open
Add set_profile method to LuxOS#409wilfredallyn wants to merge 6 commits intoUpstreamData:masterfrom
set_profile method to LuxOS#409wilfredallyn wants to merge 6 commits intoUpstreamData:masterfrom
Conversation
Add set_preset(name) method to LUXMiner for switching mining presets by name. Validates preset against available presets before making RPC calls. Refactored the ATM disable/re-enable logic shared by set_preset() and set_power_limit() into a private _switch_profile() helper. This fixes a bug in set_power_limit() where ATM could stay disabled if the profile switch failed (the re-enable was inside the same try block as the switch). The new _switch_profile() uses a finally block to ensure ATM is always re-enabled if it was disabled, regardless of whether the profile switch succeeds or fails.
Rename public API to match LuxOS terminology. Accept flexible input: "190", "190mhz", or "190MHz" all resolve to the correct firmware profile name.
for more information, see https://pre-commit.ci
wilfredallyn
commented
Feb 10, 2026
pyasic/miners/backends/luxminer.py
Outdated
Contributor
Author
There was a problem hiding this comment.
Created helper method that disables and re-enables ATM so don’t duplicate logic in methods that need to do this
| ) | ||
|
|
||
| @staticmethod | ||
| def _match_profile_name(name: str, profile_names: list[str]) -> str | None: |
Contributor
Author
There was a problem hiding this comment.
When calling set_profile, will accept 190MHz, 190mhz, or 190
pyasic/miners/backends/luxminer.py
Outdated
Contributor
Author
There was a problem hiding this comment.
Updated set_power_limit to use helper method _switch_profile
Contributor
Author
|
I went back and forth between naming it |
Collaborator
|
Set profile is fine, I don't think it matters. In theory you could add them both and have one point to the other if you want. |
Since LuxOS Feb 2025, profileset with update_atm=true (default) atomically updates ATM MaxProfile and ramps immediately. No need to manually disable/re-enable ATM. Ref: https://docs.luxor.tech/firmware/api/luxminer/profileset#using-with-atm Changes: - Remove _switch_profile() helper (ATM dance no longer needed) - set_profile() and set_power_limit() call rpc.profileset() directly - Remove ATM-related tests (disable/re-enable, re-enable failure) - Simplify test fixtures (no atm_enabled mock needed)
Contributor
Author
|
I saw in the docs that we no longer have to disable ATM before changing profile: I simplified the code in 456101c by deleting logic for disabling ATM since LuxOS handles it now |
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
Adds
set_profile(name: str) -> boolmethod to the LuxOS backend for programmatic switching between profiles (e.g.,190MHz,415MHz,565MHz).Calls
rpc.profileset()directly — since LuxOS Feb 2025,profilesetwithupdate_atm=true(the default) atomically updates ATM MaxProfile and ramps immediately. No need to manually disable/re-enable ATM.Also simplifies
set_power_limit()to userpc.profileset()directly for the same reason.Motivation
I want to be able to select a profile in Home Assistant using hass-miner. Currently, it only allows choosing a wattage. Adding
set_profileis necessary for hass-miner to be able to select a profile.Changes
pyasic/miners/backends/luxminer.py
set_profile(name: str) -> boolmethod to LUXMinerrpc.profileset()directly (LuxOS handles ATM natively)set_power_limit()to also callrpc.profileset()directly (removed ATM disable/re-enable logic)pyasic/miners/base.py
set_profile(name: str) -> boolstub to MinerProtocol base class (returns False)set_power_limit()and other control methodsTests
a. Switches profile (calls profileset directly)
b. Returns False for invalid profile name (no RPC call made)
c. Fuzzy matches case-insensitive input ("190mhz" → "190MHz")
d. Fuzzy matches number-only input ("190" → "190MHz")
e. Returns False when rpc.profileset() raises an exception
Usage
Testing