Unofficial python api for MicroBT Whatsminer ASICs

Overview

whatsminer-api

Unofficial python api for MicroBT Whatsminer ASICs

Code adapted from a python file found in the Whatsminer Telegram group that is credited to @passby

Installation

Python 3.x is required.

pip install whatsminer

Basic Usage

Instantiate a WhatsminerAccessToken for each ASIC that you want to access. Then make read-only or writeable API calls through WhatsminerAPI

Read-only information can be retrieved with just the ASIC's ip address:

from whatsminer import WhatsminerAccessToken, WhatsminerAPI

token = WhatsminerAccessToken(ip_address="192.168.1.100")
summary_json = WhatsminerAPI.get_read_only_info(access_token=token,
                                                cmd="summary")

The writeable API commands can be executed by providing the ASIC's admin password:

# The token from above can be enabled for writeable access:
token.enable_write_access(admin_password="the_admin_password")

# Or you can directly instantiate a writeable one:
token = WhatsminerAccessToken(ip_address="192.168.1.100",
                              admin_password="the_admin_passwd")

json_response = WhatsminerAPI.exec_command(access_token=token, 
                                           cmd="power_off",
                                           additional_params={"respbefore": "true"})

Writeable WhatsminerAccessToken objs will renew themselves if they go past the API's 30min expiration.

Managing multiple ASICs

You could define a whole server farm's worth of Whatsminer ASICs and manage them all in one script:

asics = [
    ('192.168.1.100', 'some_admin_pass'),
    ('192.168.1.101', 'some_admin_pass'),
    ('192.168.1.102', 'some_admin_pass'),
    ('192.168.1.103', 'some_admin_pass'),
    ('192.168.1.104', 'some_admin_pass'),
    ('192.168.1.105', 'some_admin_pass'),
]
tokens = []
for asic_info in asics:
    tokens.append(WhatsminerAccessToken(ip_address=asic_info[0], admin_password=asic_info[1]))

# Find machines running too hot
for token in tokens:
    json_summary = WhatsminerAPI.get_read_only_info(access_token=token, cmd="summary")
    if json_summary['SUMMARY'][0]['Temperature'] > 78.0:
        # stop mining on this ASIC
        WhatsminerAPI.exec_command(access_token=token, cmd="power_off", additional_params={"respbefore": "true"})

API Documentation

It's very difficult to find any information about the Whatsminer API. This PDF documentation is slightly out of date but is the best source found so far:

WhatsminerAPIV1.3.8.pdf

Package distribution notes

There are just notes to self for updating the pypi distribution

  • Update the release number in setup.py and commit to repo.
  • Draft a new release in github using the same release number.
  • Run python setup.py sdist
  • Publish the distribution to pypi: twine upload dist/*
You might also like...
TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API
TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API

TeslaPy - A Python implementation based on unofficial documentation of the client side interface to the Tesla Motors Owner API, which provides functiona

Unofficial instagram API, give you access to ALL instagram features (like, follow, upload photo and video and etc)! Write on python.

Instagram-API-python Unofficial Instagram API to give you access to ALL Instagram features (like, follow, upload photo and video, etc)! Written in Pyt

An unofficial Python wrapper for the 'Binance exchange REST API'

Welcome to binex_f v0.1.0 many interfaces are heavily used by myself in product environment, the websocket is reliable (re)connected. Latest version:

✖️ Unofficial API of 1337x.to
✖️ Unofficial API of 1337x.to

✖️ Unofficial Python API Wrapper of 1337x This is the unofficial API of 1337x. It supports all proxies of 1337x and almost all functions of 1337x. You

This is a simple unofficial async Api-wrapper for tio.run

Async-Tio This is a simple unofficial async Api-wrapper for tio.run

Unofficial API wrapper for seedr.cc

Seedr API Unofficial API wrapper for seedr.cc Inspired by theabbie's seedr-api Powered by @harp_tech (Telegram) How to use You can install lib via git

Easy Google Translate: Unofficial Google Translate API

easygoogletranslate Unofficial Google Translate API. This library does not need an api key or something else to use, it's free and simple. You can eit

Clash of Clans developer unofficial api Wrapper to generate ip based token

Clash of Clans developer unofficial api Wrapper to generate ip based token

An Unofficial API for 1337x, Piratebay, Nyaasi, Torlock, Torrent Galaxy, Zooqle, Kickass, Bitsearch, and MagnetDL

An Unofficial API for 1337x, Piratebay, Nyaasi, Torlock, Torrent Galaxy, Zooqle, Kickass, Bitsearch, and MagnetDL

Releases(0.1.2)
Owner
Satoshi Anonymoto
no, not that Satoshi you idiots.
Satoshi Anonymoto
This package accesses nitrotype's official api along with its unofficial user api

NitrotypePy This package accesses nitrotype's official api along with its unofficial user api. Currently still in development. Install To install, run

The Moon That Rises 2 Sep 4, 2022
The unofficial Amazon search CLI & Python API

amzSear The unofficial Amazon Product CLI & API. Easily search the amazon product directory from the command line without the need for an Amazon API k

Asher Silvers 95 Nov 11, 2022
🔍 Google Search unofficial API for Python with no external dependencies

Python Google Search API Unofficial Google Search API for Python. It uses web scraping in the background and is compatible with both Python 2 and 3. W

Avi Aryan 204 Dec 28, 2022
Unofficial GoPro API Library for Python - connect to GoPro via WiFi.

GoPro API for Python Unofficial GoPro API Library for Python - connect to GoPro cameras via WiFi. Compatibility: HERO3 HERO3+ HERO4 (including HERO Se

Konrad Iturbe 1.3k Jan 1, 2023
Unofficial Python wrapper for official Hacker News API

haxor Unofficial Python wrapper for official Hacker News API. Installation pip install haxor Usage Import and initialization: from hackernews import H

null 147 Sep 18, 2022
Unofficial Medium Python Flask API and SDK

PyMedium - Unofficial Medium API PyMedium is an unofficial Medium API written in python flask. It provides developers to access to user, post list and

Engine Bai 157 Nov 11, 2022
(unofficial) Googletrans: Free and Unlimited Google translate API for Python. Translates totally free of charge.

Googletrans Googletrans is a free and unlimited python library that implemented Google Translate API. This uses the Google Translate Ajax API to make

Suhun Han 3.2k Jan 4, 2023
Unofficial Python API client for Notion.so

notion-py Unofficial Python 3 client for Notion.so API v3. Object-oriented interface (mapping database tables to Python classes/attributes) Automatic

Jamie Alexandre 3.9k Jan 3, 2023
An Unofficial TikTok API Wrapper In Python

This is an unofficial api wrapper for TikTok.com in python. With this api you are able to call most trending and fetch specific user information as well as much more.

David Teather 2.9k Jan 8, 2023
Unofficial YooMoney API python library

API Yoomoney - unofficial python library This is an unofficial YooMoney API python library. Summary Introduction Features Installation Quick start Acc

Aleksey Korshuk 136 Dec 30, 2022