Skip to content
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

[QUESTION] How to set all power modes via api? #38

Closed
bondiblueos9 opened this issue Aug 10, 2021 · 4 comments
Closed

[QUESTION] How to set all power modes via api? #38

bondiblueos9 opened this issue Aug 10, 2021 · 4 comments

Comments

@bondiblueos9
Copy link

The Nicehash API allows settings power mode via POST to '/main/api/v2/mining/rigs/status2' to LOW, MEDIUM, or HIGH, which then shows up on the web interface as "Optimize", Lite, and Medium. It doesn't seem to accept any other obvious values, so I can't figure out how to use the API to set the power mode to High, Efficient, Efficient Low, Extreme, etc. Is there a different API call to use, or are there different power modes that are accepted to get the same results as with the web interface?

@xrado
Copy link
Collaborator

xrado commented Aug 11, 2021

Hi, see https://github.com/nicehash/NiceHashQuickMiner/blob/main/optimize/data_006.json prop op_names. Send id to set quickminer optimization profile. Under devices, you can see which profiles are supported for each device. This is not documented yet.

@bondiblueos9
Copy link
Author

I still can't get it to work. After setting "privapi" to a private_api initialized with host="https://api2.nicehash.com" and my organization_id, key, and secret, setting "rigId" to my rigId string, and setting "opmode" to various values, I set "request_body" as:

request_body = {"group":None,"rigId":rigId,"deviceId":"0","action":"POWER_MODE","options":[op_mode]}

And then I make the request with:

privapi.request('POST','/main/api/v2/mining/rigs/status2','',request_body)

And these is the result with various op_mode values:

op_mode = "LOW" / "MEDIUM" / "HIGH"
{u'successType': u'SUCCESSFUL', u'success': True}
(shows as "OPTIMIZE" / "LITE" / "MEDIUM" in web interface)

op_mode = "Lite" / "Medium" / "High" / "Extreme" / "Efficient" / "EfficientLow" / "Enterprise"
{u'successType': u'NOT_SUCCESSFUL', u'message': u'java.lang.IllegalArgumentException: No enum constant com.nicehash.rigmanagement.enums.MiningDevicePowerMode.Lite', u'success': False}
(the message changes to match MiningDevicePowerMode.op_mode)

op_mode = "1" / "2" / "3" / "4" / "11" / "12" / "101"
(same as with the names)

op_mode = 1 / 2 / 3 / 4 / 11 / 12 / 101
(same as with the strings)

@xrado
Copy link
Collaborator

xrado commented Aug 12, 2021

Sorry, my bad, nhqm commands are a little different.

Request body should look like this:
{"action":"NHQM_SET","options":["V=1;OP=1;"],"rigId":"user you rig id"}

where V is protocol version found on devices in nhqm info and OP is optimization profile id

To change profile only on one device add deviceId
{"action":"NHQM_SET","options":["V=1;OP=2;"],"deviceId":"1","rigId":"user you rig id"}

@bondiblueos9
Copy link
Author

Thank you! This worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants