diff --git a/cbpi/api/dataclasses.py b/cbpi/api/dataclasses.py index ffb6963..921582c 100644 --- a/cbpi/api/dataclasses.py +++ b/cbpi/api/dataclasses.py @@ -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 diff --git a/cbpi/controller/system_controller.py b/cbpi/controller/system_controller.py index 33bf050..153a05b 100644 --- a/cbpi/controller/system_controller.py +++ b/cbpi/controller/system_controller.py @@ -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 diff --git a/cbpi/extension/FermentationStep/__init__.py b/cbpi/extension/FermentationStep/__init__.py index 947be94..2d0ca32 100644 --- a/cbpi/extension/FermentationStep/__init__.py +++ b/cbpi/extension/FermentationStep/__init__.py @@ -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()