feature: improve speed of bosminer check_light by 10x using graphql.

This commit is contained in:
Upstream Data
2022-11-13 11:01:22 -07:00
parent d0da08eb10
commit 1cfd895deb

View File

@@ -18,6 +18,7 @@ import logging
from typing import List, Union
import toml
import httpx
from pyasic.API.bosminer import BOSMinerAPI
from pyasic.config import MinerConfig
@@ -242,15 +243,10 @@ class BOSMiner(BaseMiner):
await conn.run("/etc/init.d/bosminer start")
async def check_light(self) -> bool:
if self.light:
return self.light
data = (
await self.send_ssh_command("cat /sys/class/leds/'Red LED'/delay_off")
).strip()
self.light = False
if data == "50":
self.light = True
return self.light
url = f"http://{self.ip}/graphql"
async with httpx.AsyncClient() as client:
d = (await client.post(url, json={"query": "{bos {faultLight}}"})).json()
return d["data"]["bos"]["faultLight"]
async def get_errors(self) -> List[MinerErrorData]:
tunerstatus = None