braiins / bos-plus-api

BOS API
22 stars 9 forks source link

API documentation needs examples. #13

Open jtashiro opened 10 months ago

jtashiro commented 10 months ago

[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 commented 10 months ago

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 commented 9 months ago

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 commented 9 months ago

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