mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-21 22:48:16 +01:00
Added NIC Speed info to system controller
This commit is contained in:
parent
6ac93e5212
commit
c3c4101b6b
3 changed files with 31 additions and 5 deletions
|
@ -131,7 +131,7 @@ class Fermenter:
|
|||
brewname: str = None
|
||||
description : str = None
|
||||
props: Props = Props()
|
||||
target_temp: int = 0
|
||||
target_temp: float = 0
|
||||
type: str = None
|
||||
steps: List[Step]= field(default_factory=list)
|
||||
instance: str = None
|
||||
|
|
|
@ -178,6 +178,8 @@ class SystemController:
|
|||
mempercent = 0
|
||||
eth0IP = "N/A"
|
||||
wlan0IP = "N/A"
|
||||
eth0speed = "N/A"
|
||||
wlan0speed = "N/A"
|
||||
|
||||
TEMP_UNIT=self.cbpi.config.get("TEMP_UNIT", "C")
|
||||
FAHRENHEIT = False if TEMP_UNIT == "C" else True
|
||||
|
@ -225,12 +227,23 @@ class SystemController:
|
|||
if str(addr.family) == "AddressFamily.AF_INET":
|
||||
if addr.address:
|
||||
wlan0IP = addr.address
|
||||
info = psutil.net_if_stats()
|
||||
try:
|
||||
for nic in info:
|
||||
if nic == 'eth0':
|
||||
if info[nic].speed:
|
||||
eth0speed = info[nic].speed
|
||||
if nic == 'wlan0':
|
||||
if info[nic].speed:
|
||||
wlan0speed = info[nic].speed
|
||||
except Exception as e:
|
||||
logging.info(e)
|
||||
except:
|
||||
pass
|
||||
|
||||
if system == "Windows":
|
||||
try:
|
||||
ethernet = psutil.net_if_addrs()
|
||||
ethernet = psutil.net_if_addrs()
|
||||
for nic, addrs in ethernet.items():
|
||||
if nic == "Ethernet":
|
||||
for addr in addrs:
|
||||
|
@ -242,6 +255,17 @@ class SystemController:
|
|||
if str(addr.family) == "AddressFamily.AF_INET":
|
||||
if addr.address:
|
||||
wlan0IP = addr.address
|
||||
info = psutil.net_if_stats()
|
||||
try:
|
||||
for nic in info:
|
||||
if nic == 'Ethernet':
|
||||
if info[nic].speed:
|
||||
eth0speed = info[nic].speed
|
||||
if nic == 'WLAN':
|
||||
if info[nic].speed:
|
||||
wlan0speed = info[nic].speed
|
||||
except Exception as e:
|
||||
logging.info(e)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
@ -258,7 +282,9 @@ class SystemController:
|
|||
'temp': temp,
|
||||
'temp_unit': TEMP_UNIT,
|
||||
'eth0': eth0IP,
|
||||
'wlan0': wlan0IP}
|
||||
'wlan0': wlan0IP,
|
||||
'eth0speed': eth0speed,
|
||||
'wlan0speed': wlan0speed}
|
||||
return systeminfo
|
||||
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class FermenterTargetTempStep(CBPiFermentationStep):
|
|||
self.shutdown = False
|
||||
self.AutoMode = True if self.props.get("AutoMode","No") == "Yes" else False
|
||||
if self.fermenter is not None:
|
||||
self.fermenter.target_temp = int(self.props.get("Temp", 0))
|
||||
self.fermenter.target_temp = float(self.props.get("Temp", 0))
|
||||
if self.AutoMode == True:
|
||||
await self.setAutoMode(True)
|
||||
self.summary = "Waiting for Target Temp"
|
||||
|
@ -204,7 +204,7 @@ class FermenterStep(CBPiFermentationStep):
|
|||
|
||||
self.AutoMode = True if self.props.get("AutoMode", "No") == "Yes" else False
|
||||
if self.fermenter is not None:
|
||||
self.fermenter.target_temp = int(self.props.get("Temp", 0))
|
||||
self.fermenter.target_temp = float(self.props.get("Temp", 0))
|
||||
if self.AutoMode == True:
|
||||
await self.setAutoMode(True)
|
||||
await self.push_update()
|
||||
|
|
Loading…
Reference in a new issue