added temperatures to the tool, and fixed a bug with multicommand not removing bad commands if they were adjacent to each other in the list

This commit is contained in:
UpstreamData
2022-01-05 15:33:56 -07:00
parent e77cbc5415
commit 1148946a29
6 changed files with 42 additions and 44 deletions

View File

@@ -42,14 +42,9 @@ class BaseMinerAPI:
"""Creates and sends multiple commands as one command to the miner."""
# split the commands into a proper list
commands = [*commands]
for item in commands:
# make sure we can actually run the command, otherwise it will fail
if item not in self.get_commands():
# if the command isn't allowed, remove it
print(f"Removing incorrect command: {item}")
commands.remove(item)
allowed_commands = self.get_commands()
# make sure we can actually run the command, otherwise it will fail
commands = [command for command in commands if command in allowed_commands]
# standard multicommand format is "command1+command2"
# doesnt work for S19 which is dealt with in the send command function
command = "+".join(commands)

View File

@@ -525,24 +525,10 @@ class BTMinerAPI(BaseMinerAPI):
"""
return await self.send_command("status")
async def get_miner_info(self, info: str | list):
async def get_miner_info(self):
"""
API 'get_miner_info' command.
Returns a dict containing requested information.
Parameters:
info: the info that you want to get.
"ip",
"proto",
"netmask",
"gateway",
"dns",
"hostname",
"mac",
"ledstat".
Returns a dict containing general miner info.
"""
if isinstance(info, str):
return await self.send_command("get_miner_info", parameters=info)
else:
return await self.send_command("get_miner_info", parameters=f"{','.join([str(item) for item in info])}")
return await self.send_command("get_miner_info")