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

API documentation needs examples. #13

Open
jtashiro opened this issue Jan 1, 2024 · 3 comments
Open

API documentation needs examples. #13

jtashiro opened this issue Jan 1, 2024 · 3 comments

Comments

@jtashiro
Copy link

jtashiro commented Jan 1, 2024

[Updated] I was looking for an example grpcurl script that has full parameters required to change the power target on a miner. My use case is to run miner at the lowest power possible during evening, and max/full power during the day when my solar panels are active. I've put this into cron job on a nearby linux machine.

I reviewed the authenticate script and proto files and figured out that the message parameters are positional along with the names of the variables. Some variables are expected in json format, and was able to work out this syntax after reviewing the other proto files (units for Power) and reverse engineered the json format. Suggest adding something like this to the package in examples directory. May be cleaner with proto files ?

thanks for making this possible.

examples/setPowerTarget.sh:

#!/bin/sh
USERNAME=xxx
PASSWORD=yyy
BOSMINER=miner:50051

# authenticate to miner
BOSAUTH=$(grpcurl -plaintext -vv -d '{"username": "'"$USERNAME"'", "password": "'"${PASSWORD}"'"}' "${BOSMINER}" braiins.bos.v1.AuthenticationService/Login|awk '$1=="authorization:" {printf "%s%s",$1,$2}')

# set miner performance power target
SAVE_ACTION_AND_APPLY=2
WATTS=1800
grpcurl -plaintext -vv -H "${BOSAUTH}" -d '{"save_action": "'"${SAVE_ACTION_AND_APPLY}"'", "power_target": { "watt": "'"${WATTS}"'"}}' "${BOSMINER}" braiins.bos.v1.PerformanceService/SetPowerTarget

thanks

@kamil-triscik
Copy link
Collaborator

Hello,
thank you for this issue.

We know we have to prepare more examples and overall improve documentation. It is one of our goals for the following weeks/months.

Kamil Triscik
Braiins

@epper202
Copy link

epper202 commented Feb 6, 2024

Hello, thank you for this issue.

We know we have to prepare more examples and overall improve documentation. It is one of our goals for the following weeks/months.

Kamil Triscik Braiins

Eagerly waiting.. Maybe an example in Postman?
Much appreciated

@epper202
Copy link

Hello, thank you for this issue.
We know we have to prepare more examples and overall improve documentation. It is one of our goals for the following weeks/months.
Kamil Triscik Braiins

Eagerly waiting.. Maybe an example in Postman? Much appreciated

If anyone wants help, I've figured it out to use server reflection with Postman! Works like a charm.
Feel free to send DM or reply

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

3 participants