refactor: add default values for data locations to reduce duplication.

This commit is contained in:
UpstreamData
2024-01-16 09:31:23 -07:00
parent f820372532
commit 10293ae24a
14 changed files with 238 additions and 223 deletions

View File

@@ -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"),
}
)