-
Notifications
You must be signed in to change notification settings - Fork 82
Add Braiins serial number support for PSU and hashboards #402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add Braiins serial number support for PSU and hashboards #402
Conversation
- Add ControlBoardSocFamily enum for control board SoC identification - Add PsuInfo message with PSU serial number, version, firmware, model - Extend GetMinerDetailsResponse with miner serial number and PSU info - Extend Hashboard message with serial number and additional fields (lowest inlet temperature, highest outlet temperature, board name, chip type) - Mark PSU voltage fields as optional to match upstream proto Supports API v1.5.0+ and firmware 25.03+ Closes UpstreamData#390
- Add PSU_SERIAL_NUMBER to DataOptions enum - Add psu_serial_number field to MinerData class - Document PSU serial number in MinerData docstring - Enables collecting and exposing PSU serials from compatible miners
- Add public get_psu_serial_number() method to miner interface - Add protected _get_psu_serial_number() method with default no-op impl - Allows subclasses to implement PSU serial retrieval
- Add _get_serial_number() for miner serial from get_miner_details gRPC - Add _get_psu_serial_number() for PSU serial from psuInfo - Add SERIAL_NUMBER and PSU_SERIAL_NUMBER to BOSER_DATA_LOC mapping - Populate hashboard.serial_number from get_hashboards response Supports API v1.5.0+ (firmware 25.03+) with miner, PSU, and hashboard serial numbers now available via get_data() method
- Add psu_serial_number to expected data location keys in MinersTest - Ensures all miner types include PSU serial in data mapping
|
Did you do the gRPC implementation updates manually? |
- Add tests/local_tests/ directory for manual hardware tests - Add test_braiins_serials.py script to test miner, PSU, and hashboard serials - Add README.md with usage instructions and troubleshooting - Add __init__.py to mark directory as package These are optional local tests for developers testing with real hardware
for more information, see https://pre-commit.ci
Here's a response to the reviewer's question in English: No, the gRPC implementation updates were not done entirely manually. The file init.py is a generated file (as indicated by the header: "Generated by the protocol buffer compiler. DO NOT EDIT!"). The new message types and fields were generated from the upstream Braiins OS Plus API v1.5.0+ Protocol Buffer definitions. Here's how the process works:
Added Components (all derived from the latest Proto definitions):
All these fields align with the current Braiins API specification. The implementation layer (braiins_os.py) was written manually to extract and expose these proto fields through the standard pyasic interface. |
- Remove try-except blocks for AttributeError since dict.get() doesn't raise it - Simplify code flow for better static analysis compliance
- Remove trailing colons from headings - Add blank line before list items for better readability
- Reduce function complexity by splitting into smaller functions - Remove hardcoded passwords from function defaults (security) - Fix README line length issues (80 char limit) - Change H1 to H2 header for proper document structure - Simplify text for better readability
Tested locally on Braiins BMM100 miner
Summary
This PR implements support for retrieving serial numbers from Braiins OS Plus miners as described in issue #390.
Features
get_serial_number()andminer_data.serial_numberget_psu_serial_number()andminer_data.psu_serial_numberminer_data.hashboards[n].serial_numberImplementation Details
Changes Made
Updated BOS gRPC Proto Definitions
ControlBoardSocFamilyenum for control board SoC identificationPsuInfomessage with PSU serial number, version, firmware, and model fieldsGetMinerDetailsResponsewith miner serial number and PSU infoHashboardmessage with serial number and additional fieldsExtended Data Model
PSU_SERIAL_NUMBERtoDataOptionsenumpsu_serial_numberfield toMinerDataclassUpdated Base Miner Class
get_psu_serial_number()method_get_psu_serial_number()method with default no-op implementationImplemented for BOSer Miners
_get_serial_number()to fetch miner serial from gRPC_get_psu_serial_number()to fetch PSU serial from psuInfoBOSER_DATA_LOCmapping with both serial optionsUpdated Tests
psu_serial_numberto expected data location keysCompatibility
Related Issues
Closes #390