feature: rework whatsminer error codes to be able to allow an arbitrary slot number to be returned from the BTMiner API.

This commit is contained in:
UpstreamData
2022-11-08 15:08:31 -07:00
parent aba8d7b8b9
commit 81aa569d07

View File

@@ -27,16 +27,25 @@ class WhatsminerError:
error_code: int error_code: int
error_message: str = field(init=False) error_message: str = field(init=False)
@classmethod @classmethod
def fields(cls): def fields(cls):
return fields(cls) return fields(cls)
@property @property
def error_message(self): # noqa - Skip PyCharm inspection def error_message(self): # noqa - Skip PyCharm inspection
if self.error_code in ERROR_CODES: err_type = int(str(self.error_code)[:-2])
return ERROR_CODES[self.error_code] err_subtype = int(str(self.error_code)[-2:-1])
return "Unknown error type." err_value = int(str(self.error_code)[-1:])
try:
select_err_subtype = ERROR_CODES[err_type][err_subtype]
if err_value in select_err_subtype:
return select_err_subtype[err_value]
elif "n" in select_err_subtype:
return select_err_subtype["n"].replace("{n}", str(err_value)) # noqa: picks up `select_err_subtype["n"]` as not being numeric?
else:
return "Unknown error type."
except KeyError:
return "Unknown error type."
@error_message.setter @error_message.setter
def error_message(self, val): def error_message(self, val):
@@ -47,131 +56,158 @@ class WhatsminerError:
ERROR_CODES = { ERROR_CODES = {
110: "Intake fan speed error.", 1: { # Fan error
111: "Exhaust fan speed error.", 1: { # Fan speed error of 1000+
120: "Intake fan speed error. Fan speed deviates by more than 2000.", 0: "Intake fan speed error.",
121: "Exhaust fan speed error. Fan speed deviates by more than 2000.", 1: "Exhaust fan speed error.",
130: "Intake fan speed error. Fan speed deviates by more than 3000.", },
131: "Exhaust fan speed error. Fan speed deviates by more than 3000.", 2: { # Fan speed error of 2000+
140: "Fan speed too high.", 0: "Intake fan speed error. Fan speed deviates by more than 2000.",
200: "Power probing error. No power found.", 1: "Exhaust fan speed error. Fan speed deviates by more than 2000.",
201: "Power supply and configuration file don't match.", },
202: "Power output voltage error.", 3: { # Fan speed error of 3000+
203: "Power protecting due to high environment temperature.", 0: "Intake fan speed error. Fan speed deviates by more than 3000.",
204: "Power current protecting due to high environment temperature.", 1: "Exhaust fan speed error. Fan speed deviates by more than 3000.",
205: "Power current error.", },
206: "Power input low voltage error.", 4: {0: "Fan speed too high."}, # High speed
207: "Power input current protecting due to bad power input.", },
210: "Power error.", 2: { # Power error
213: "Power input voltage and current do not match power output.", 0: {
216: "Power remained unchanged for a long time.", 0: "Power probing error. No power found.",
217: "Power set enable error.", 1: "Power supply and configuration file don't match.",
218: "Power input voltage is lower than 230V for high power mode.", 2: "Power output voltage error.",
233: "Power output high temperature protection error.", 3: "Power protecting due to high environment temperature.",
234: "Power output high temperature protection error.", 4: "Power current protecting due to high environment temperature.",
235: "Power output high temperature protection error.", 5: "Power current error.",
236: "Power output high current protection error.", 6: "Power input low voltage error.",
237: "Power output high current protection error.", 7: "Power input current protecting due to bad power input.",
238: "Power output high current protection error.", },
239: "Power output high voltage protection error.", 1: {
240: "Power output low voltage protection error.", 0: "Power error.",
241: "Power output current imbalance error.", 3: "Power input voltage and current do not match power output.",
243: "Power input high temperature protection error.", 6: "Power remained unchanged for a long time.",
244: "Power input high temperature protection error.", 7: "Power set enable error.",
245: "Power input high temperature protection error.", 8: "Power input voltage is lower than 230V for high power mode.",
246: "Power input high voltage protection error.", },
247: "Power input high voltage protection error.", 3: {
248: "Power input high current protection error.", 3: "Power output high temperature protection error.",
249: "Power input high current protection error.", 4: "Power output high temperature protection error.",
250: "Power input low voltage protection error.", 5: "Power output high temperature protection error.",
251: "Power input low voltage protection error.", 6: "Power output high current protection error.",
253: "Power supply fan error.", 7: "Power output high current protection error.",
254: "Power supply fan error.", 8: "Power output high current protection error.",
255: "Power output high power protection error.", 9: "Power output high voltage protection error.",
256: "Power output high power protection error.", },
257: "Input over current protection of power supply on primary side.", 4: {
263: "Power communication warning.", 0: "Power output low voltage protection error.",
264: "Power communication error.", 1: "Power output current imbalance error.",
267: "Power watchdog protection.", 3: "Power input high temperature protection error.",
268: "Power output high current protection.", 4: "Power input high temperature protection error.",
269: "Power input high current protection.", 5: "Power input high temperature protection error.",
270: "Power input high voltage protection.", 6: "Power input high voltage protection error.",
271: "Power input low voltage protection.", 7: "Power input high voltage protection error.",
272: "Excessive power supply output warning.", 8: "Power input high current protection error.",
273: "Power input too high warning.", 9: "Power input high current protection error.",
274: "Power fan warning.", },
275: "Power high temperature warning.", 5: {
300: "Right board temperature sensor detection error.", 0: "Power input low voltage protection error.",
301: "Center board temperature sensor detection error.", 1: "Power input low voltage protection error.",
302: "Left board temperature sensor detection error.", 3: "Power supply fan error.",
320: "Right board temperature reading error.", 4: "Power supply fan error.",
321: "Center board temperature reading error.", 5: "Power output high power protection error.",
322: "Left board temperature reading error.", 6: "Power output high power protection error.",
329: "Control board temperature sensor communication error.", 7: "Input over current protection of power supply on primary side.",
350: "Right board temperature protecting.", },
351: "Center board temperature protecting.", 6: {
352: "Left board temperature protecting.", 3: "Power communication warning.",
360: "Hashboard high temperature error.", 4: "Power communication error.",
410: "Right board eeprom detection error.", 7: "Power watchdog protection.",
411: "Center board eeprom detection error.", 8: "Power output high current protection.",
412: "Left board eeprom detection error.", 9: "Power input high current protection.",
420: "Right board eeprom parsing error.", },
421: "Center board eeprom parsing error.", 7: {
422: "Left board eeprom parsing error.", 0: "Power input high voltage protection.",
430: "Right board chip bin type error.", 1: "Power input low voltage protection.",
431: "Center board chip bin type error.", 2: "Excessive power supply output warning.",
432: "Left board chip bin type error.", 3: "Power input too high warning.",
440: "Right board eeprom chip number X error.", 4: "Power fan warning.",
441: "Center board eeprom chip number X error.", 5: "Power high temperature warning.",
442: "Left board eeprom chip number X error.", },
450: "Right board eeprom xfer error.", },
451: "Center board eeprom xfer error.", 3: { # temperature error
452: "Left board eeprom xfer error.", 0: { # sensor detection error
510: "Right board miner type error.", "n": "Slot {n} temperature sensor detection error."
511: "Center board miner type error.", },
512: "Left board miner type error.", 2: { # temperature reading error
520: "Right board bin type error.", "n": "Slot {n} temperature reading error.",
521: "Center board bin type error.", 9: "Control board temperature sensor communication error.",
522: "Left board bin type error.", },
530: "Right board not found.", 5: {"n": "Slot {n} temperature protecting."}, # temperature protection
531: "Center board not found.", 6: {0: "Hashboard high temperature error."}, # high temp
532: "Left board not found.", },
540: "Right board error reading chip id.", 4: { # EEPROM error
541: "Center board error reading chip id.", 1: {"n": "Slot {n} eeprom detection error."}, # EEPROM detection error
542: "Left board error reading chip id.", 2: {"n": "Slot {n} eeprom parsing error."}, # EEPROM parsing error
550: "Right board has bad chips.", 3: {"n": "Slot {n} chip bin type error."}, # chip bin error
551: "Center board has bad chips.", 4: {"n": "Slot {n} eeprom chip number X error."}, # EEPROM chip number error
552: "Left board has bad chips.", 5: {"n": "Slot {n} eeprom xfer error."}, # EEPROM xfer error
560: "Right board loss of balance error.", },
561: "Center board loss of balance error.", 5: { # hashboard error
562: "Left board loss of balance error.", 1: {"n": "Slot {n} miner type error."}, # board miner type error
600: "Environment temperature is too high.", 2: {"n": "Slot {n} bin type error."}, # chip bin type error
610: "Environment temperature is too high for high performance mode.", 3: {"n": "Slot {n} not found."}, # board not found error
701: "Control board no support chip.", 4: {"n": "Slot {n} error reading chip id."}, # reading chip id error
710: "Control board rebooted as an exception.", 5: {"n": "Slot {n} has bad chips."}, # board has bad chips error
712: "Control board rebooted as an exception.", 6: {"n": "Slot {n} loss of balance error."}, # loss of balance error
800: "CGMiner checksum error.", },
801: "System monitor checksum error.", 6: { # env temp error
802: "Remote daemon checksum error.", 0: {0: "Environment temperature is too high."}, # normal env temp error
2010: "All pools are disabled.", 1: { # high power env temp error
2020: "Pool 0 connection failed.", 0: "Environment temperature is too high for high performance mode."
2021: "Pool 1 connection failed.", },
2022: "Pool 2 connection failed.", },
2023: "Pool 3 connection failed.", 7: { # control board error
2030: "High rejection rate on pool.", 0: {1: "Control board no support chip."},
2040: "The pool does not support asicboost mode.", 1: {
2310: "Hashrate is too low.", 0: "Control board rebooted as an exception.",
2320: "Hashrate is too low.", 2: "Control board rebooted as an exception.",
2340: "Hashrate loss is too high.", },
2350: "Hashrate loss is too high.", },
5070: "Right hashboard water velocity is abnormal.", 8: { # checksum error
5071: "Center hashboard water velocity is abnormal.", 0: {
5072: "Left hashboard water velocity is abnormal.", 0: "CGMiner checksum error.",
5110: "Right hashboard frequency up timeout.", 1: "System monitor checksum error.",
5111: "Center hashboard frequency up timeout.", 2: "Remote daemon checksum error.",
5112: "Left hashboard frequency up timeout.", }
8410: "Software version error.", },
100001: "/antiv/signature illegal.", 20: { # pool error
100002: "/antiv/dig/init.d illegal.", 1: {0: "All pools are disabled."}, # all disabled error
100003: "/antiv/dig/pf_partial.dig illegal.", 2: {"n": "Pool {n} connection failed."}, # pool connection failed error
3: {0: "High rejection rate on pool."}, # rejection rate error
4: { # asicboost not supported error
0: "The pool does not support asicboost mode."
},
},
23: { # hashrate error
1: {0: "Hashrate is too low."},
2: {0: "Hashrate is too low."},
3: {0: "Hashrate loss is too high."},
4: {0: "Hashrate loss is too high."},
},
50: { # water velocity error
7: {"n": "Slot {n} water velocity is abnormal."}, # abnormal water velocity
},
51: { # frequency error
7: {"n": "Slot {n} frequency up timeout."}, # frequency up timeout
},
84: {
1: {0: "Software version error."},
},
1000: {
0: {
1: "/antiv/signature illegal.",
2: "/antiv/dig/init.d illegal.",
3: "/antiv/dig/pf_partial.dig illegal.",
},
},
} }