Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

Commit 5457ae6

Browse files
committed
feature: add support for avalon Q
1 parent aa3d105 commit 5457ae6

13 files changed

Lines changed: 463 additions & 149 deletions

File tree

docs/miners/supported_types.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,12 @@ details {
565565
<li><a href="../avalonminer/A15X#avalon-1566-stock">Avalon 1566 (Stock)</a></li>
566566
</ul>
567567
</details>
568+
<details>
569+
<summary>Q Series:</summary>
570+
<ul>
571+
<li><a href="../avalonminer/Q#avalon-q-home-stock">Avalon Q Home (Stock)</a></li>
572+
</ul>
573+
</details>
568574
</ul>
569575
</details>
570576
<details>

pyasic/device/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ class AvalonminerModels(MinerModelType):
456456
Avalon1566 = "Avalon 1566"
457457
AvalonNano3 = "Avalon Nano 3"
458458
AvalonNano3s = "Avalon Nano 3s"
459+
AvalonQHome = "Avalon Q Home"
459460

460461
def __str__(self):
461462
return self.value
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright 2025 Upstream Data Inc -
3+
# -
4+
# Licensed under the Apache License, Version 2.0 (the "License"); -
5+
# you may not use this file except in compliance with the License. -
6+
# You may obtain a copy of the License at -
7+
# -
8+
# http://www.apache.org/licenses/LICENSE-2.0 -
9+
# -
10+
# Unless required by applicable law or agreed to in writing, software -
11+
# distributed under the License is distributed on an "AS IS" BASIS, -
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
13+
# See the License for the specific language governing permissions and -
14+
# limitations under the License. -
15+
# ------------------------------------------------------------------------------
16+
17+
from pyasic.miners.backends import AvalonMiner
18+
from pyasic.miners.device.models import AvalonQHome
19+
20+
21+
class CGMinerAvalonQHome(AvalonMiner, AvalonQHome):
22+
pass
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .Q import CGMinerAvalonQHome

pyasic/miners/avalonminer/cgminer/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
from .A12X import *
2323
from .A15X import *
2424
from .nano import *
25+
from .Q import *

pyasic/miners/avalonminer/cgminer/nano/nano3.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,31 @@
4949
),
5050
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
5151
"_get_expected_hashrate",
52-
[RPCAPICommand("rpc_stats", "stats")],
52+
[RPCAPICommand("rpc_estats", "estats")],
5353
),
5454
str(DataOptions.HASHBOARDS): DataFunction(
5555
"_get_hashboards",
56-
[RPCAPICommand("rpc_stats", "stats")],
56+
[RPCAPICommand("rpc_estats", "estats")],
5757
),
5858
str(DataOptions.ENVIRONMENT_TEMP): DataFunction(
5959
"_get_env_temp",
60-
[RPCAPICommand("rpc_stats", "stats")],
60+
[RPCAPICommand("rpc_estats", "estats")],
6161
),
6262
str(DataOptions.WATTAGE_LIMIT): DataFunction(
6363
"_get_wattage_limit",
64-
[RPCAPICommand("rpc_stats", "stats")],
64+
[RPCAPICommand("rpc_estats", "estats")],
6565
),
6666
str(DataOptions.WATTAGE): DataFunction(
6767
"_get_wattage",
68-
[RPCAPICommand("rpc_stats", "stats")],
68+
[RPCAPICommand("rpc_estats", "estats")],
6969
),
7070
str(DataOptions.FANS): DataFunction(
7171
"_get_fans",
72-
[RPCAPICommand("rpc_stats", "stats")],
72+
[RPCAPICommand("rpc_estats", "estats")],
7373
),
7474
str(DataOptions.FAULT_LIGHT): DataFunction(
7575
"_get_fault_light",
76-
[RPCAPICommand("rpc_stats", "stats")],
76+
[RPCAPICommand("rpc_estats", "estats")],
7777
),
7878
str(DataOptions.UPTIME): DataFunction(
7979
"_get_uptime",
@@ -102,35 +102,35 @@
102102
),
103103
str(DataOptions.HASHRATE): DataFunction(
104104
"_get_hashrate",
105-
[RPCAPICommand("rpc_stats", "stats")],
105+
[RPCAPICommand("rpc_estats", "estats")],
106106
),
107107
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
108108
"_get_expected_hashrate",
109-
[RPCAPICommand("rpc_stats", "stats")],
109+
[RPCAPICommand("rpc_estats", "estats")],
110110
),
111111
str(DataOptions.HASHBOARDS): DataFunction(
112112
"_get_hashboards",
113-
[RPCAPICommand("rpc_stats", "stats")],
113+
[RPCAPICommand("rpc_estats", "estats")],
114114
),
115115
str(DataOptions.ENVIRONMENT_TEMP): DataFunction(
116116
"_get_env_temp",
117-
[RPCAPICommand("rpc_stats", "stats")],
117+
[RPCAPICommand("rpc_estats", "estats")],
118118
),
119119
str(DataOptions.WATTAGE_LIMIT): DataFunction(
120120
"_get_wattage_limit",
121-
[RPCAPICommand("rpc_stats", "stats")],
121+
[RPCAPICommand("rpc_estats", "estats")],
122122
),
123123
str(DataOptions.WATTAGE): DataFunction(
124124
"_get_wattage",
125-
[RPCAPICommand("rpc_stats", "stats")],
125+
[RPCAPICommand("rpc_estats", "estats")],
126126
),
127127
str(DataOptions.FANS): DataFunction(
128128
"_get_fans",
129-
[RPCAPICommand("rpc_stats", "stats")],
129+
[RPCAPICommand("rpc_estats", "estats")],
130130
),
131131
str(DataOptions.FAULT_LIGHT): DataFunction(
132132
"_get_fault_light",
133-
[RPCAPICommand("rpc_stats", "stats")],
133+
[RPCAPICommand("rpc_estats", "estats")],
134134
),
135135
str(DataOptions.UPTIME): DataFunction(
136136
"_get_uptime",
@@ -170,58 +170,58 @@ class CGMinerAvalonNano3s(AvalonMiner, AvalonNano3s):
170170

171171
data_locations = AVALON_NANO3S_DATA_LOC
172172

173-
async def _get_wattage(self, rpc_stats: dict = None) -> Optional[int]:
174-
if rpc_stats is None:
173+
async def _get_wattage(self, rpc_estats: dict = None) -> Optional[int]:
174+
if rpc_estats is None:
175175
try:
176-
rpc_stats = await self.rpc.stats()
176+
rpc_estats = await self.rpc.estats()
177177
except APIError:
178178
pass
179179

180-
if rpc_stats is not None:
180+
if rpc_estats is not None:
181181
try:
182-
unparsed_stats = rpc_stats["STATS"][0]["MM ID0"]
183-
parsed_stats = self.parse_stats(unparsed_stats)
184-
return int(parsed_stats["PS"][6])
182+
unparsed_estats = rpc_estats["STATS"][0]["MM ID0"]
183+
parsed_estats = self.parse_estats(unparsed_estats)
184+
return int(parsed_estats["PS"][6])
185185
except (IndexError, KeyError, ValueError, TypeError):
186186
pass
187187

188-
async def _get_hashrate(self, rpc_stats: dict = None) -> Optional[AlgoHashRate]:
189-
if rpc_stats is None:
188+
async def _get_hashrate(self, rpc_estats: dict = None) -> Optional[AlgoHashRate]:
189+
if rpc_estats is None:
190190
try:
191-
rpc_stats = await self.rpc.stats()
191+
rpc_estats = await self.rpc.estats()
192192
except APIError:
193193
pass
194194

195-
if rpc_stats is not None:
195+
if rpc_estats is not None:
196196
try:
197-
unparsed_stats = rpc_stats["STATS"][0]["MM ID0"]
198-
parsed_stats = self.parse_stats(unparsed_stats)
197+
unparsed_estats = rpc_estats["STATS"][0]["MM ID0"]
198+
parsed_estats = self.parse_estats(unparsed_estats)
199199
return self.algo.hashrate(
200-
rate=float(parsed_stats["GHSspd"][0]), unit=self.algo.unit.GH
200+
rate=float(parsed_estats["GHSspd"]), unit=self.algo.unit.GH
201201
).into(self.algo.unit.default)
202202
except (IndexError, KeyError, ValueError, TypeError):
203203
pass
204204

205-
async def _get_hashboards(self, rpc_stats: dict = None) -> List[HashBoard]:
206-
hashboards = await AvalonMiner._get_hashboards(self, rpc_stats)
205+
async def _get_hashboards(self, rpc_estats: dict = None) -> List[HashBoard]:
206+
hashboards = await AvalonMiner._get_hashboards(self, rpc_estats)
207207

208-
if rpc_stats is None:
208+
if rpc_estats is None:
209209
try:
210-
rpc_stats = await self.rpc.stats()
210+
rpc_estats = await self.rpc.estats()
211211
except APIError:
212212
pass
213213

214-
if rpc_stats is not None:
214+
if rpc_estats is not None:
215215

216216
try:
217-
unparsed_stats = rpc_stats["STATS"][0]["MM ID0"]
218-
parsed_stats = self.parse_stats(unparsed_stats)
217+
unparsed_estats = rpc_estats["STATS"][0]["MM ID0"]
218+
parsed_estats = self.parse_estats(unparsed_estats)
219219
except (IndexError, KeyError, ValueError, TypeError):
220220
return hashboards
221221

222222
for board in range(len(hashboards)):
223223
try:
224-
board_hr = parsed_stats["GHSspd"][board]
224+
board_hr = parsed_estats["GHSspd"][board]
225225
hashboards[board].hashrate = self.algo.hashrate(
226226
rate=float(board_hr), unit=self.algo.unit.GH
227227
).into(self.algo.unit.default)

0 commit comments

Comments
 (0)