refactor: add default values for data locations to reduce duplication.
This commit is contained in:
@@ -34,45 +34,49 @@ from pyasic.web.antminer import AntminerModernWebAPI, AntminerOldWebAPI
|
||||
ANTMINER_MODERN_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac", [WebAPICommand("web_get_system_info", "get_system_info")]
|
||||
"_get_mac",
|
||||
[WebAPICommand("web_get_system_info", "get_system_info")],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_fw_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction(
|
||||
"_get_hostname", [WebAPICommand("web_get_system_info", "get_system_info")]
|
||||
"_get_hostname",
|
||||
[WebAPICommand("web_get_system_info", "get_system_info")],
|
||||
),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction("_get_hashboards"),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction("_get_wattage"),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction("_get_wattage_limit"),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction(
|
||||
"_get_errors", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_errors",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction(
|
||||
"_get_fault_light",
|
||||
[WebAPICommand("web_get_blink_status", "get_blink_status")],
|
||||
),
|
||||
str(DataOptions.IS_MINING): DataFunction(
|
||||
"_is_mining", [WebAPICommand("web_get_conf", "get_miner_conf")]
|
||||
"_is_mining",
|
||||
[WebAPICommand("web_get_conf", "get_miner_conf")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -344,44 +348,46 @@ class AntminerModern(BMMiner):
|
||||
|
||||
ANTMINER_OLD_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction("_get_mac"),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_fw_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction(
|
||||
"_get_hostname", [WebAPICommand("web_get_system_info", "get_system_info")]
|
||||
"_get_hostname",
|
||||
[WebAPICommand("web_get_system_info", "get_system_info")],
|
||||
),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction("_get_wattage"),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction("_get_wattage_limit"),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction("_get_errors"),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction(
|
||||
"_get_fault_light",
|
||||
[WebAPICommand("web_get_blink_status", "get_blink_status")],
|
||||
),
|
||||
str(DataOptions.IS_MINING): DataFunction(
|
||||
"_is_mining", [WebAPICommand("web_get_conf", "get_miner_conf")]
|
||||
"_is_mining",
|
||||
[WebAPICommand("web_get_conf", "get_miner_conf")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -31,35 +31,30 @@ from pyasic.rpc.bfgminer import BFGMinerRPCAPI
|
||||
|
||||
BFGMINER_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction("_get_mac"),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_fw_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction("_get_hostname"),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction("_get_wattage"),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction("_get_wattage_limit"),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction("_get_errors"),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction("_get_fault_light"),
|
||||
str(DataOptions.IS_MINING): DataFunction("_is_mining"),
|
||||
str(DataOptions.UPTIME): DataFunction("_get_uptime"),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -32,20 +32,24 @@ from pyasic.web.goldshell import GoldshellWebAPI
|
||||
GOLDSHELL_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac", [WebAPICommand("web_setting", "setting")]
|
||||
"_get_mac",
|
||||
[WebAPICommand("web_setting", "setting")],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [WebAPICommand("web_status", "status")]
|
||||
"_get_fw_ver",
|
||||
[WebAPICommand("web_status", "status")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction("_get_hostname"),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards",
|
||||
@@ -54,18 +58,10 @@ GOLDSHELL_DATA_LOC = DataLocations(
|
||||
RPCAPICommand("api_devdetails", "devdetails"),
|
||||
],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction("_get_wattage"),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction("_get_wattage_limit"),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction("_get_errors"),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction("_get_fault_light"),
|
||||
str(DataOptions.IS_MINING): DataFunction("_is_mining"),
|
||||
str(DataOptions.UPTIME): DataFunction("_get_uptime"),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -32,37 +32,34 @@ from pyasic.rpc.bmminer import BMMinerRPCAPI
|
||||
|
||||
BMMINER_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction("_get_mac"),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_fw_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction("_get_hostname"),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction("_get_wattage"),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction("_get_wattage_limit"),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction("_get_errors"),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction("_get_fault_light"),
|
||||
str(DataOptions.IS_MINING): DataFunction("_is_mining"),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -44,18 +44,20 @@ BOSMINER_DATA_LOC = DataLocations(
|
||||
[WebAPICommand("web_net_conf", "admin/network/iface_status/lan")],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [WebAPICommand("web_bos_info", "bos/info")]
|
||||
"_get_fw_ver",
|
||||
[WebAPICommand("web_bos_info", "bos/info")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction("_get_hostname"),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_devs", "devs")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_devs", "devs")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards",
|
||||
@@ -65,7 +67,6 @@ BOSMINER_DATA_LOC = DataLocations(
|
||||
RPCAPICommand("api_devs", "devs"),
|
||||
],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage",
|
||||
[RPCAPICommand("api_tunerstatus", "tunerstatus")],
|
||||
@@ -78,19 +79,18 @@ BOSMINER_DATA_LOC = DataLocations(
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_fans", "fans")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction(
|
||||
"_get_errors",
|
||||
[RPCAPICommand("api_tunerstatus", "tunerstatus")],
|
||||
),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction("_get_fault_light"),
|
||||
str(DataOptions.IS_MINING): DataFunction(
|
||||
"_is_mining", [RPCAPICommand("api_devdetails", "devdetails")]
|
||||
"_is_mining",
|
||||
[RPCAPICommand("api_devdetails", "devdetails")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -649,7 +649,8 @@ BOSER_DATA_LOC = DataLocations(
|
||||
[GRPCCommand("grpc_miner_details", "get_miner_details")],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [GRPCCommand("api_version", "get_api_version")]
|
||||
"_get_api_ver",
|
||||
[GRPCCommand("api_version", "get_api_version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver",
|
||||
@@ -671,7 +672,6 @@ BOSER_DATA_LOC = DataLocations(
|
||||
"_get_hashboards",
|
||||
[GRPCCommand("grpc_hashboards", "get_hashboards")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage",
|
||||
[GRPCCommand("grpc_miner_stats", "get_miner_stats")],
|
||||
@@ -688,7 +688,6 @@ BOSER_DATA_LOC = DataLocations(
|
||||
"_get_fans",
|
||||
[GRPCCommand("grpc_cooling_state", "get_cooling_state")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction(
|
||||
"_get_errors",
|
||||
[RPCAPICommand("api_tunerstatus", "tunerstatus")],
|
||||
@@ -698,12 +697,13 @@ BOSER_DATA_LOC = DataLocations(
|
||||
[GRPCCommand("grpc_locate_device_status", "get_locate_device_status")],
|
||||
),
|
||||
str(DataOptions.IS_MINING): DataFunction(
|
||||
"_is_mining", [RPCAPICommand("api_devdetails", "devdetails")]
|
||||
"_is_mining",
|
||||
[RPCAPICommand("api_devdetails", "devdetails")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ BTMINER_DATA_LOC = DataLocations(
|
||||
],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_get_version", "get_version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_get_version", "get_version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver",
|
||||
@@ -50,25 +51,32 @@ BTMINER_DATA_LOC = DataLocations(
|
||||
],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction(
|
||||
"_get_hostname", [RPCAPICommand("api_get_miner_info", "get_miner_info")]
|
||||
"_get_hostname",
|
||||
[RPCAPICommand("api_get_miner_info", "get_miner_info")],
|
||||
),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards", [RPCAPICommand("api_devs", "devs")]
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("api_devs", "devs")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction(
|
||||
"_get_env_temp", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_env_temp",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_wattage",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction(
|
||||
"_get_wattage_limit", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_wattage_limit",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans",
|
||||
@@ -96,12 +104,13 @@ BTMINER_DATA_LOC = DataLocations(
|
||||
[RPCAPICommand("api_get_miner_info", "get_miner_info")],
|
||||
),
|
||||
str(DataOptions.IS_MINING): DataFunction(
|
||||
"_is_mining", [RPCAPICommand("api_status", "status")]
|
||||
"_is_mining",
|
||||
[RPCAPICommand("api_status", "status")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -32,37 +32,34 @@ from pyasic.rpc.cgminer import CGMinerRPCAPI
|
||||
|
||||
CGMINER_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction("_get_mac"),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_fw_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction("_get_hostname"),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction("_get_wattage"),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction("_get_wattage_limit"),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction("_get_errors"),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction("_get_fault_light"),
|
||||
str(DataOptions.IS_MINING): DataFunction("_is_mining"),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -27,42 +27,45 @@ from pyasic.miners.base import DataFunction, DataLocations, DataOptions, RPCAPIC
|
||||
AVALON_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac", [RPCAPICommand("api_version", "version")]
|
||||
"_get_mac",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_fw_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction("_get_hostname"),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_devs", "devs")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_devs", "devs")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction(
|
||||
"_get_env_temp", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_env_temp",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.WATTAGE): DataFunction("_get_wattage"),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction(
|
||||
"_get_wattage_limit", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_wattage_limit",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction("_get_errors"),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction(
|
||||
"_get_fault_light", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_fault_light",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.IS_MINING): DataFunction("_is_mining"),
|
||||
str(DataOptions.UPTIME): DataFunction("_get_uptime"),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -33,20 +33,24 @@ from pyasic.web.epic import ePICWebAPI
|
||||
EPIC_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac", [WebAPICommand("web_network", "network")]
|
||||
"_get_mac",
|
||||
[WebAPICommand("web_network", "network")],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction("_get_api_ver"),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_fw_ver",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction(
|
||||
"_get_hostname", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_hostname",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_expected_hashrate",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards",
|
||||
@@ -55,26 +59,26 @@ EPIC_DATA_LOC = DataLocations(
|
||||
WebAPICommand("web_hashrate", "hashrate"),
|
||||
],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_wattage",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction("_get_wattage_limit"),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_fans",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction(
|
||||
"_get_errors", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_errors",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction(
|
||||
"_get_fault_light", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_fault_light",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.IS_MINING): DataFunction("_is_mining"),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_uptime",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -23,41 +23,42 @@ from pyasic.miners.base import DataFunction, DataLocations, DataOptions, RPCAPIC
|
||||
|
||||
HIVEON_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction("get_mac"),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_fw_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction("_get_hostname"),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction(
|
||||
"_get_env_temp", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_env_temp",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_wattage",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction("get_wattage_limit"),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction("_get_errors"),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction("_get_fault_light"),
|
||||
str(DataOptions.IS_MINING): DataFunction("_is_mining"),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -40,12 +40,13 @@ INNOSILICON_DATA_LOC = DataLocations(
|
||||
],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_fw_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction("_get_hostname"),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate",
|
||||
[
|
||||
@@ -53,9 +54,6 @@ INNOSILICON_DATA_LOC = DataLocations(
|
||||
WebAPICommand("web_get_all", "getAll"),
|
||||
],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate",
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards",
|
||||
[
|
||||
@@ -63,7 +61,6 @@ INNOSILICON_DATA_LOC = DataLocations(
|
||||
WebAPICommand("web_get_all", "getAll"),
|
||||
],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage",
|
||||
[
|
||||
@@ -90,12 +87,10 @@ INNOSILICON_DATA_LOC = DataLocations(
|
||||
WebAPICommand("web_get_error_detail", "getErrorDetail"),
|
||||
],
|
||||
),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction("_get_fault_light"),
|
||||
str(DataOptions.IS_MINING): DataFunction("_is_mining"),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -31,36 +31,32 @@ from pyasic.rpc.luxminer import LUXMinerRPCAPI
|
||||
LUXMINER_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac", [RPCAPICommand("api_config", "config")]
|
||||
"_get_mac",
|
||||
[RPCAPICommand("api_config", "config")],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction("_get_api_ver"),
|
||||
str(DataOptions.FW_VERSION): DataFunction("_get_fw_ver"),
|
||||
str(DataOptions.HOSTNAME): DataFunction("_get_hostname"),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage", [RPCAPICommand("api_power", "power")]
|
||||
"_get_wattage",
|
||||
[RPCAPICommand("api_power", "power")],
|
||||
),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction("_get_wattage_limit"),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [RPCAPICommand("api_fans", "fans")]
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_fans", "fans")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction("_get_errors"),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction("_get_fault_light"),
|
||||
str(DataOptions.IS_MINING): DataFunction("_is_mining"),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime", [RPCAPICommand("api_stats", "stats")]
|
||||
),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -31,42 +31,45 @@ from pyasic.web.vnish import VNishWebAPI
|
||||
VNISH_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_mac",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver", [RPCAPICommand("api_version", "version")]
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("api_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_fw_ver",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction(
|
||||
"_get_hostname", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_hostname",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate", [RPCAPICommand("api_summary", "summary")]
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("api_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("_get_env_temp"),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage", [WebAPICommand("web_summary", "summary")]
|
||||
"_get_wattage",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction(
|
||||
"_get_wattage_limit", [WebAPICommand("web_settings", "settings")]
|
||||
"_get_wattage_limit",
|
||||
[WebAPICommand("web_settings", "settings")],
|
||||
),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans", [RPCAPICommand("api_stats", "stats")]
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FAN_PSU): DataFunction("_get_fan_psu"),
|
||||
str(DataOptions.ERRORS): DataFunction("_get_errors"),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction("_get_fault_light"),
|
||||
str(DataOptions.IS_MINING): DataFunction("_is_mining"),
|
||||
str(DataOptions.UPTIME): DataFunction("_get_uptime"),
|
||||
str(DataOptions.CONFIG): DataFunction("get_config"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -52,6 +52,14 @@ class DataOptions(Enum):
|
||||
def __str__(self):
|
||||
return self.value
|
||||
|
||||
def default_command(self):
|
||||
if str(self.value) == "config":
|
||||
return "get_config"
|
||||
elif str(self.value) == "is_mining":
|
||||
return "_is_mining"
|
||||
else:
|
||||
return f"_get_{str(self.value)}"
|
||||
|
||||
|
||||
@dataclass
|
||||
class RPCAPICommand:
|
||||
@@ -87,10 +95,15 @@ class DataFunction:
|
||||
|
||||
DataLocations = make_dataclass(
|
||||
"DataLocations",
|
||||
[(enum_value.value, str) for enum_value in DataOptions],
|
||||
[
|
||||
(
|
||||
enum_value.value,
|
||||
DataFunction,
|
||||
field(default_factory=lambda: DataFunction(enum_value.default_command())),
|
||||
)
|
||||
for enum_value in DataOptions
|
||||
],
|
||||
)
|
||||
# add default value with
|
||||
# [(enum_value.value, str, , DataFunction(enum_value.value)) for enum_value in DataOptions],
|
||||
|
||||
|
||||
class BaseMiner(ABC):
|
||||
|
||||
Reference in New Issue
Block a user