Package: mmpos
Python MMPOS API Library and CLI toolThe MMPOS crypto mining platform has a REST API that allows us to make changes without using the GUI.
This python module brings the power of that API to a native python library and command line tool.InstallationIf you don't usepipx, you're missing out.
Here areinstallation instructions.Simply run:pipx install . (For installing locally in isolated environment with pipx)Orpip3 install mmposRequirementsPython 3.8+It may work with older python versions, especially 3.x versions, but I am only testing 3.8+.FeaturesList rig dataList gpu dataList farm dataList mining profilesShow data in either table or json formatsControl a rig (disable, enable, reset, poweroff, ...)Control rig one at a time, everything all at once.  (Disable everything!)Simulate the control action if you are feeling worried.Set mining profileUse short ids to identify components of MMPOSOutput json, plain and table format, pipe into other commandsCLI UsageTo use it:$ mmpos --helpEach command allows you to list the data in json or table format.  The json output usually provides more output while the table is human readable and provides a subset of the total information.All commands have--jsonand--table.  Use the--helpto verify these switches work for that command.Examples:$mmpos--help
Usage:mmpos[OPTIONS]COMMAND[ARGS]...

Options:--helpShowthismessageandexit.

Commands:farmsrigs

$mmposfarms--helpUsage:mmposfarms[OPTIONS]COMMAND[ARGS]...

Options:--helpShowthismessageandexit.

Commands:list

$mmposrigs--help
Usage:mmposrigs[OPTIONS]COMMAND[ARGS]...

Options:--helpShowthismessageandexit.

Commands:controlgpuslist

$mmposrigscontrol--help
Usage:mmposrigscontrol[OPTIONS]Options:--rig_idTEXTTherigid,notrequiredwhenusing--allor--everywhereflags--farm_idTEXTThefarmid,defaultstofirstfarmfound,use'--all'flagforallfarms[default:first]--allRunactiononallrigsacrosstheentirefarm--everywhereDanger:Runactiononallrigsacrossallfarms--action[disable|poweroff|reset|enable|restart|reboot][required]--simulateSimulatetheactiononly--helpShowthismessageandexit.Output FormatYou can adjust the output format from the default table format to json output.  Table output will normally be shorter and the json will provide much greater detail.API UsageI have built this with the intention of using the api in other areas of automation like ansible playbooks and such.  Usage should be pretty
simple.  The API will change in the future as I build out the remaining MMPOS API calls.pip install mmpos
import mmpos.api.farms as farms
import mmpos.api.rigs as rigs

farms.get()
rigs.get()NotesThis is alpha quality, expect things to change, feature requests welcome as is any code contributions.Most data is cached for 5 minutes to speed up future calls.  You will notice this when repeating calls. This can be controlled as the underlying mechanism is requests_cache library.Using short idsThe MMPOS API uses long uuids as their identifiers.  This makes it annoying to work with on the CLI due to 36 character length.As a result I have created a translation layer that will encode the uuid into 8 characters.  You can use this id for all commands.  Or you can also use the original uuid as well should you want to supply the 36 character id. Please note that the shorty id is only usable on this tool.  Although the formula for calculating can be implemented anywhere.This shortens the command considerably.example:mmpos rigs set-profiles -r a3ea61dd -f cd371105 -p a44551e4vs./env/bin/mmpos rigs set-profiles --farm_id=ef86da23-0044-4530-b00d-124093cece80 --rig_id=85fbbe8d-6388-4b9e-8e2f-e897a7e7a6c5 --profile_ids=b49b6a13-e4ba-4991-a823-557f23754e80Global switchesSome switches are only available at the global level.  You will need to put the switch aftermmposto use them.ie.mmpos --json rigs list -f dksl39932Usage: mmpos [OPTIONS] COMMAND [ARGS]...

Options:
  --version                     Show the version and exit.
  --table                       Show table output
  --json                        Show json output
  --plain                       Show plain output
  --short-ids / --no-short-ids  Use short id instead of uuid from mmpos
                                [default: short-ids]
  --help                        Show this message and exit.

Commands:
  farms
  profiles
  rigsExamples# mmpos rigs list 
+--------------------------------------+--------------+---------------+-----------------------------------+---------------+
|                  id                  |     name     |    address    |              profiles             | agent_version |
+--------------------------------------+--------------+---------------+-----------------------------------+---------------+
| 365155f7-0425-4742-9465-7d8208464d51 | machine12345 |  192.168.0.1  |       ['etc_eth_ethermine']       |    v3.0.18    |
| 0fde950d-f321-4459-badd-9a7529dbe32b | machine22345 |  192.168.0.2  |       ['etchash_amd_normal']      |    v3.0.20    |
| 3fa0a53b-1bd9-4c09-91af-e134126c4219 | machine32345 |  192.168.0.3  |       ['etc_eth_ethermine']       |    v3.0.18    |
| 98d40b07-7090-42a8-8282-3e70e404d98c | machine42345 |  192.168.0.4  |       ['etc_eth_ethermine']       |    v3.0.19    |
| 5b00e155-ea64-414e-86af-2acc4e1ee716 | machine52345 |  192.168.0.5  |       ['etchash_amd_normal']      |    v3.0.19    |
+--------------------------------------+--------------+---------------+-----------------------------------+---------------+

# mmpos rigs gpus
+--------------+--------------------------+---------------+--------------------------------------+------------+
|   rig_name   |           name           |    address    |                gpu_id                |   pci_id   |
+--------------+--------------------------+---------------+--------------------------------------+------------+
| 0291ba94bb74 |    Radeon RX 5700 XT     |  192.168.0.1  | ef86da23-0044-4530-b00d-124093cece80 | 0000:0d:00 |
| 0291ba94bb74 | AMD Ryzen 7 3700X 8-Core |  192.168.0.1  | b49b6a13-e4ba-4991-a823-557f23754e80 | cpu0:08:10 |
|   super12    |    Radeon RX 6700 XT     |  192.168.0.2  | afa7b6b5-78da-436c-a3d9-c60d9dcdba73 | 0000:04:00 |
|   super12    |    Radeon RX 6700 XT     |  192.168.0.2  | 85fbbe8d-6388-4b9e-8e2f-e897a7e7a6c5 | 0000:07:00 |
+--------------+--------------------------+---------------+--------------------------------------+------------+



# mmpos rigs control --all --farm_id=first --action disable
+--------------+---------+
|   rig_name   |  action |
+--------------+---------+
|    machine1  | disable |
|    machine2  | disable |
|    machine3  | disable |
|    machine4  | disable |
+--------------+---------+

# mmpos rigs set-profiles -r xxxxxx -f xxxxxx -p xxxxxx -p xxxxxxxy (multiple -p will set multiple profiles)