diff --git a/API/__init__.py b/API/__init__.py index b85c912e..96f7839a 100644 --- a/API/__init__.py +++ b/API/__init__.py @@ -22,6 +22,9 @@ class BaseMinerAPI: self.port = port self.ip = ipaddress.ip_address(ip) + def get_commands(self): + return [func for func in dir(self) if callable(getattr(self, func)) and not func.startswith("__") and func not in [func for func in dir(BaseMinerAPI) if callable(getattr(BaseMinerAPI, func))]] + async def multicommand(self, *commands: str) -> dict: command = "+".join(commands) return await self.send_command(command) diff --git a/main.py b/main.py index 72d32f57..2984859c 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,12 @@ from API.bosminer import BOSMinerAPI +from API.bmminer import BMMinerAPI from network import MinerNetwork import asyncio async def main(): + api = BMMinerAPI("192.168.1.1") + print(api.get_commands()) miner_network = MinerNetwork("192.168.1.1") await miner_network.scan_network_for_miners()