add miner data documentation
This commit is contained in:
@@ -13,8 +13,8 @@ Getting started with pyasic is easy. First, find your miner (or miners) on the
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
## Scanning for miners
|
## Scanning for miners
|
||||||
To scan for miners in pyasic, we use the class `MinerNetwork`, which abstracts the search, communication, identification, setup, and return of a miner to 1 command.
|
To scan for miners in pyasic, we use the class [`MinerNetwork`][pyasic.network.MinerNetwork], which abstracts the search, communication, identification, setup, and return of a miner to 1 command.
|
||||||
The command `MinerNetwork().scan_network_for_miners()` returns a list that contains any miners found.
|
The command [`MinerNetwork().scan_network_for_miners()`][pyasic.network.MinerNetwork.scan_network_for_miners] returns a list that contains any miners found.
|
||||||
```python
|
```python
|
||||||
import asyncio # asyncio for handling the async part
|
import asyncio # asyncio for handling the async part
|
||||||
from pyasic.network import MinerNetwork # miner network handles the scanning
|
from pyasic.network import MinerNetwork # miner network handles the scanning
|
||||||
@@ -37,8 +37,8 @@ if __name__ == "__main__":
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
## Creating miners based on IP
|
## Creating miners based on IP
|
||||||
If you already know the IP address of your miner or miners, you can use the `MinerFactory` to communicate and identify the miners.
|
If you already know the IP address of your miner or miners, you can use the [`MinerFactory`][pyasic.miners.miner_factory.MinerFactory] to communicate and identify the miners.
|
||||||
The function `MinerFactory().get_miner()` will return any miner it found at the IP address specified, or an `UnknownMiner` if it cannot identify the miner.
|
The function [`MinerFactory().get_miner()`][pyasic.miners.miner_factory.MinerFactory.get_miner] will return any miner it found at the IP address specified, or an `UnknownMiner` if it cannot identify the miner.
|
||||||
```python
|
```python
|
||||||
import asyncio # asyncio for handling the async part
|
import asyncio # asyncio for handling the async part
|
||||||
from pyasic.miners.miner_factory import MinerFactory # miner factory handles miners creation
|
from pyasic.miners.miner_factory import MinerFactory # miner factory handles miners creation
|
||||||
@@ -61,8 +61,8 @@ if __name__ == "__main__":
|
|||||||
## Getting data from miners
|
## Getting data from miners
|
||||||
|
|
||||||
Once you have your miner(s) identified, you will likely want to get data from the miner(s). You can do this using a built in function in each miner called `get_data()`.
|
Once you have your miner(s) identified, you will likely want to get data from the miner(s). You can do this using a built in function in each miner called `get_data()`.
|
||||||
This function will return a instance of the dataclass `MinerData` with all data it can gather from the miner.
|
This function will return a instance of the dataclass [`MinerData`][pyasic.data.MinerData] with all data it can gather from the miner.
|
||||||
Each piece of data in a `MinerData` instance can be referenced by getting it as an attribute, such as `MinerData().hashrate`
|
Each piece of data in a [`MinerData`][pyasic.data.MinerData] instance can be referenced by getting it as an attribute, such as [`MinerData().hashrate`][pyasic.data.MinerData].
|
||||||
```python
|
```python
|
||||||
import asyncio
|
import asyncio
|
||||||
from pyasic.miners.miner_factory import MinerFactory
|
from pyasic.miners.miner_factory import MinerFactory
|
||||||
|
|||||||
8
docs/miner_data.md
Normal file
8
docs/miner_data.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# pyasic
|
||||||
|
## Miner Data
|
||||||
|
|
||||||
|
::: pyasic.data.MinerData
|
||||||
|
handler: python
|
||||||
|
options:
|
||||||
|
show_root_heading: false
|
||||||
|
heading_level: 4
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
# pyasic
|
# pyasic
|
||||||
## Miner Network
|
## Miner Network
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
::: pyasic.network.MinerNetwork
|
::: pyasic.network.MinerNetwork
|
||||||
handler: python
|
handler: python
|
||||||
options:
|
options:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ nav:
|
|||||||
- Usage:
|
- Usage:
|
||||||
- Miner Factory: "miner_factory.md"
|
- Miner Factory: "miner_factory.md"
|
||||||
- Miner Network: "miner_network.md"
|
- Miner Network: "miner_network.md"
|
||||||
|
- Miner Data: "miner_data.md"
|
||||||
- Advanced:
|
- Advanced:
|
||||||
- API: "api.md"
|
- API: "api.md"
|
||||||
|
|
||||||
|
|||||||
@@ -4,35 +4,44 @@ from datetime import datetime
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class MinerData:
|
class MinerData:
|
||||||
"""A Dataclass to standardize data returned from miners (specifically AnyMiner().get_data())
|
"""A Dataclass to standardize data returned from miners (specifically `AnyMiner().get_data()`)
|
||||||
|
|
||||||
:param ip: The IP of the miner as a str.
|
Attributes:
|
||||||
:param datetime: The time and date this data was generated.
|
ip: The IP of the miner as a str.
|
||||||
:param model: The model of the miner as a str.
|
datetime: The time and date this data was generated.
|
||||||
:param hostname: The network hostname of the miner as a str.
|
model: The model of the miner as a str.
|
||||||
:param hashrate: The hashrate of the miner in TH/s as a int.
|
hostname: The network hostname of the miner as a str.
|
||||||
:param left_board_temp: The temp of the left PCB as an int.
|
hashrate: The hashrate of the miner in TH/s as a float.
|
||||||
:param left_board_chip_temp: The temp of the left board chips as an int.
|
left_board_hashrate: The hashrate of the left board of the miner in TH/s as a float.
|
||||||
:param center_board_temp: The temp of the center PCB as an int.
|
center_board_hashrate: The hashrate of the center board of the miner in TH/s as a float.
|
||||||
:param center_board_chip_temp: The temp of the center board chips as an int.
|
right_board_hashrate: The hashrate of the right board of the miner in TH/s as a float.
|
||||||
:param right_board_temp: The temp of the right PCB as an int.
|
temperature_avg: The average temperature across the boards. Calculated automatically.
|
||||||
:param right_board_chip_temp: The temp of the right board chips as an int.
|
env_temp: The environment temps as a float.
|
||||||
:param wattage: Current power draw of the miner as an int.
|
left_board_temp: The temp of the left PCB as an int.
|
||||||
:param wattage_limit: Power limit of the miner as an int.
|
left_board_chip_temp: The temp of the left board chips as an int.
|
||||||
:param fan_1: The speed of the first fan as an int.
|
center_board_temp: The temp of the center PCB as an int.
|
||||||
:param fan_2: The speed of the second fan as an int.
|
center_board_chip_temp: The temp of the center board chips as an int.
|
||||||
:param fan_3: The speed of the third fan as an int.
|
right_board_temp: The temp of the right PCB as an int.
|
||||||
:param fan_4: The speed of the fourth fan as an int.
|
right_board_chip_temp: The temp of the right board chips as an int.
|
||||||
:param left_chips: The number of chips online in the left board as an int.
|
wattage: Current power draw of the miner as an int.
|
||||||
:param center_chips: The number of chips online in the left board as an int.
|
wattage_limit: Power limit of the miner as an int.
|
||||||
:param right_chips: The number of chips online in the left board as an int.
|
fan_1: The speed of the first fan as an int.
|
||||||
:param ideal_chips: The ideal number of chips in the miner as an int.
|
fan_2: The speed of the second fan as an int.
|
||||||
:param pool_split: The pool split as a str.
|
fan_3: The speed of the third fan as an int.
|
||||||
:param pool_1_url: The first pool url on the miner as a str.
|
fan_4: The speed of the fourth fan as an int.
|
||||||
:param pool_1_user: The first pool user on the miner as a str.
|
left_chips: The number of chips online in the left board as an int.
|
||||||
:param pool_2_url: The second pool url on the miner as a str.
|
center_chips: The number of chips online in the left board as an int.
|
||||||
:param pool_2_user: The second pool user on the miner as a str.
|
right_chips: The number of chips online in the left board as an int.
|
||||||
:param errors: A list of errors on the miner.
|
total_chips: The total number of chips on all boards. Calculated automatically.
|
||||||
|
ideal_chips: The ideal number of chips in the miner as an int.
|
||||||
|
perecent_ideal: The percent of total chips out of the ideal count. Calculated automatically.
|
||||||
|
nominal: The nominal amount of chips in the miner. Calculated automatically.
|
||||||
|
pool_split: The pool split as a str.
|
||||||
|
pool_1_url: The first pool url on the miner as a str.
|
||||||
|
pool_1_user: The first pool user on the miner as a str.
|
||||||
|
pool_2_url: The second pool url on the miner as a str.
|
||||||
|
pool_2_user: The second pool user on the miner as a str.
|
||||||
|
errors: A list of errors on the miner.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ip: str
|
ip: str
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import ipaddress
|
import ipaddress
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
from pyasic.network.net_range import MinerNetworkRange
|
from pyasic.network.net_range import MinerNetworkRange
|
||||||
from pyasic.miners.miner_factory import MinerFactory
|
from pyasic.miners.miner_factory import MinerFactory
|
||||||
@@ -26,7 +27,7 @@ class MinerNetwork:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, ip_addr: str or None = None, mask: str or int or None = None
|
self, ip_addr: Union[str, None] = None, mask: Union[str, int, None] = None
|
||||||
) -> None:
|
) -> None:
|
||||||
self.network = None
|
self.network = None
|
||||||
self.ip_addr = ip_addr
|
self.ip_addr = ip_addr
|
||||||
|
|||||||
Reference in New Issue
Block a user