implemented getting hostnames for bosminers

This commit is contained in:
UpstreamData
2021-10-21 14:26:48 -06:00
parent f09ce7227f
commit 1ca39260b4
2 changed files with 21 additions and 8 deletions

View File

@@ -66,6 +66,12 @@ class BOSminer(BaseMiner):
def update_config(self, config: dict) -> None:
self.config = config
async def get_hostname(self) -> str:
async with asyncssh.connect(str(self.ip), known_hosts=None, username='root', password='admin',
server_host_key_algs=['ssh-rsa']) as conn:
data = await conn.run('cat /proc/sys/kernel/hostname')
return data.stdout.strip()
async def change_config_format(self, update_config: bool = False) -> dict:
if not self.config:
await self.get_config()