added mac addresses to get_data
This commit is contained in:
@@ -35,6 +35,7 @@ class MinerData:
|
|||||||
|
|
||||||
ip: str
|
ip: str
|
||||||
datetime: datetime = None
|
datetime: datetime = None
|
||||||
|
mac: str = "00:00:00:00:00:00"
|
||||||
model: str = "Unknown"
|
model: str = "Unknown"
|
||||||
hostname: str = "Unknown"
|
hostname: str = "Unknown"
|
||||||
hashrate: float = 0
|
hashrate: float = 0
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ class BMMiner(BaseMiner):
|
|||||||
|
|
||||||
model = await self.get_model()
|
model = await self.get_model()
|
||||||
hostname = await self.get_hostname()
|
hostname = await self.get_hostname()
|
||||||
|
mac = await self.get_mac()
|
||||||
|
|
||||||
if model:
|
if model:
|
||||||
data.model = model
|
data.model = model
|
||||||
@@ -142,6 +143,9 @@ class BMMiner(BaseMiner):
|
|||||||
if hostname:
|
if hostname:
|
||||||
data.hostname = hostname
|
data.hostname = hostname
|
||||||
|
|
||||||
|
if mac:
|
||||||
|
data.mac = mac
|
||||||
|
|
||||||
miner_data = None
|
miner_data = None
|
||||||
for i in range(DATA_RETRIES):
|
for i in range(DATA_RETRIES):
|
||||||
miner_data = await self.api.multicommand(
|
miner_data = await self.api.multicommand(
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ class BOSMiner(BaseMiner):
|
|||||||
|
|
||||||
model = await self.get_model()
|
model = await self.get_model()
|
||||||
hostname = await self.get_hostname()
|
hostname = await self.get_hostname()
|
||||||
|
mac = await self.get_mac()
|
||||||
|
|
||||||
if model:
|
if model:
|
||||||
data.model = model
|
data.model = model
|
||||||
@@ -271,6 +272,9 @@ class BOSMiner(BaseMiner):
|
|||||||
if hostname:
|
if hostname:
|
||||||
data.hostname = hostname
|
data.hostname = hostname
|
||||||
|
|
||||||
|
if mac:
|
||||||
|
data.mac = mac
|
||||||
|
|
||||||
miner_data = None
|
miner_data = None
|
||||||
for i in range(DATA_RETRIES):
|
for i in range(DATA_RETRIES):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -93,18 +93,24 @@ class BTMiner(BaseMiner):
|
|||||||
try:
|
try:
|
||||||
model = await self.get_model()
|
model = await self.get_model()
|
||||||
hostname = await self.get_hostname()
|
hostname = await self.get_hostname()
|
||||||
|
mac = await self.get_mac()
|
||||||
except APIError:
|
except APIError:
|
||||||
logging.warning(f"Failed to get hostname and model: {self}")
|
logging.warning(f"Failed to get hostname, mac, and model: {self}")
|
||||||
model = None
|
model = None
|
||||||
data.model = "Whatsminer"
|
data.model = "Whatsminer"
|
||||||
hostname = None
|
hostname = None
|
||||||
data.hostname = "Whatsminer"
|
data.hostname = "Whatsminer"
|
||||||
|
mac = None
|
||||||
|
|
||||||
if model:
|
if model:
|
||||||
data.model = model
|
data.model = model
|
||||||
|
|
||||||
if hostname:
|
if hostname:
|
||||||
data.hostname = hostname
|
data.hostname = hostname
|
||||||
|
|
||||||
|
if mac:
|
||||||
|
data.mac = mac
|
||||||
|
|
||||||
miner_data = None
|
miner_data = None
|
||||||
for i in range(DATA_RETRIES):
|
for i in range(DATA_RETRIES):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -113,12 +113,17 @@ class CGMiner(BaseMiner):
|
|||||||
|
|
||||||
model = await self.get_model()
|
model = await self.get_model()
|
||||||
hostname = await self.get_hostname()
|
hostname = await self.get_hostname()
|
||||||
|
mac = await self.get_mac()
|
||||||
|
|
||||||
if model:
|
if model:
|
||||||
data.model = model
|
data.model = model
|
||||||
|
|
||||||
if hostname:
|
if hostname:
|
||||||
data.hostname = hostname
|
data.hostname = hostname
|
||||||
|
|
||||||
|
if mac:
|
||||||
|
data.mac = mac
|
||||||
|
|
||||||
miner_data = None
|
miner_data = None
|
||||||
for i in range(DATA_RETRIES):
|
for i in range(DATA_RETRIES):
|
||||||
miner_data = await self.api.multicommand("summary", "pools", "stats")
|
miner_data = await self.api.multicommand("summary", "pools", "stats")
|
||||||
|
|||||||
@@ -25,6 +25,19 @@ class BMMinerS17(BMMiner, S17):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -22,6 +22,19 @@ class BMMinerS17Plus(BMMiner, S17Plus):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -22,6 +22,19 @@ class BMMinerS17Pro(BMMiner, S17Pro):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -22,6 +22,19 @@ class BMMinerS17e(BMMiner, S17e):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -22,6 +22,19 @@ class BMMinerT17(BMMiner, T17):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -22,6 +22,19 @@ class BMMinerT17Plus(BMMiner, T17Plus):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -22,6 +22,19 @@ class BMMinerT17e(BMMiner, T17e):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -26,6 +26,19 @@ class BMMinerS19(BMMiner, S19):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -23,6 +23,19 @@ class BMMinerS19Pro(BMMiner, S19Pro):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -23,6 +23,19 @@ class BMMinerS19a(BMMiner, S19a):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -23,6 +23,19 @@ class BMMinerS19j(BMMiner, S19j):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -23,6 +23,19 @@ class BMMinerS19jPro(BMMiner, S19jPro):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
@@ -23,6 +23,19 @@ class BMMinerT19(BMMiner, T19):
|
|||||||
hostname = data["hostname"]
|
hostname = data["hostname"]
|
||||||
return hostname
|
return hostname
|
||||||
|
|
||||||
|
async def get_mac(self):
|
||||||
|
mac = None
|
||||||
|
url = f"http://{self.ip}/cgi-bin/get_system_info.cgi"
|
||||||
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
data = await client.get(url, auth=auth)
|
||||||
|
if data.status_code == 200:
|
||||||
|
data = data.json()
|
||||||
|
if len(data.keys()) > 0:
|
||||||
|
if "macaddr" in data.keys():
|
||||||
|
mac = data["macaddr"]
|
||||||
|
return mac
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
url = f"http://{self.ip}/cgi-bin/blink.cgi"
|
||||||
auth = httpx.DigestAuth("root", "root")
|
auth = httpx.DigestAuth("root", "root")
|
||||||
|
|||||||
Reference in New Issue
Block a user