def refresh(self): while (self.shm.connectState != 3): if (self.shm.connectState == 2): now = datetime.datetime.now() if (now - self.memoNowSensorSerial > self.deltaTimeSensorSerial): self.memoNowSensorSerial = now self.logic() self.set_diArduino('VMC',self.shm.VMCPower) self.set_diArduino('Ventilo-SdB1',self.shm.ventiloSdbPower) self.set_diArduino('Ventilo-SdB2',self.shm.ventiloSdbPower) try: self.shm.ventiloSdbSpeed = self.set_PWMArduino('Ventilo-SdB',self.shm.ventiloSdbReq) except: DomoUtils().printlog('PWM Sdb setting error \n') self.shm.ventiloSdbSpeed = 9999 #self.shm.rpmSdb = self.get_valueArduino('Ventilo-SdB-Speed') self.set_diArduino('Ventilo-Couloir1',self.shm.ventiloCouloirPower) self.set_diArduino('Ventilo-Couloir2',self.shm.ventiloCouloirPower) try: self.shm.ventiloCouloirSpeed = self.set_PWMArduino('Ventilo-Couloir',self.shm.ventiloCouloirReq) except: DomoUtils().printlog('PWM couloir setting error \n') self.shm.ventiloSdbSpeed = 9999 #self.shm.rpmCouloir = self.get_valueArduino('Ventilo-Couloir-Speed') self.set_diArduino('Audio-Cuisine',self.shm.audioCuisinePower) self.set_diArduino('Audio-SdB',self.shm.audioSdbPower) self.set_diArduino('Audio-Chambre',self.shm.audioChambrePower) self.set_diArduino('Thermostat',self.shm.forceChaudiere) error, self.shm.tempPC, self.shm.humPC = self.get_dth22Arduino('PC') error, self.shm.tempSdb, self.shm.humSdb = self.get_dth22Arduino('SdB') error, self.shm.tempSalon, self.shm.humSalon = self.get_dth22Arduino('Salon') error, self.shm.tempExt, self.shm.humExt = self.get_dth22Arduino('Ext') self.shm.porteFermee = self.get_switchArduino('Porte') if (now - self.memoNowSensorEthernet > self.deltaTimeSensorEthernet): self.memoNowSensorEthernet = now try: self.get_dth22Ethernet(self.caveHost,self.cavePort) except: self.shm.tempCave = 999.9 self.shm.humCave = 999.9 self.shm.presenceCave = 0 DomoData.write_file(self, self.filePath)
def refresh(self): while self.shm.connectState == 1: now = datetime.datetime.now() if now - self.memoNowSensorSerial > self.deltaTimeSensorFast: self.memoNowSensorSerial = now self.logic() self.set_ArduinoValue(self.oidVMCState, self.Host, self.shm.VMCPower) self.set_ArduinoValue(self.oidVentiloSdB1State, self.Host, self.shm.ventiloSdbPower) self.set_ArduinoValue(self.oidVentiloSdB2State, self.Host, self.shm.ventiloSdbPower) self.set_ArduinoValue(self.oidVentiloCouloir1State, self.Host, self.shm.ventiloCouloirPower) self.set_ArduinoValue(self.oidVentiloCouloir2State, self.Host, self.shm.ventiloCouloirPower) self.shm.ventiloSdbSpeed = self.set_ArduinoValue( self.oidVentiloSdBSpeed, self.Host, self.shm.ventiloSdbReq ) self.shm.ventiloCouloirSpeed = self.set_ArduinoValue( self.oidVentiloCouloirSpeed, self.Host, self.shm.ventiloCouloirReq ) self.set_ArduinoValue(self.oidAmpliCuisineState, self.Host, self.shm.audioCuisinePower) self.set_ArduinoValue(self.oidAmpliSdBState, self.Host, self.shm.audioSdbPower) self.set_ArduinoValue(self.oidAmpliChambreState, self.Host, self.shm.audioChambrePower) self.set_ArduinoValue(self.oidThermostatState, self.Host, self.shm.forceChaudiere) self.shm.porteFermee = self.get_ArduinoValue(self.oidPorteState, self.Host) if now - self.memoNowSensorEthernet > self.deltaTimeSensorSnmp: self.memoNowSensorEthernet = now try: self.get_dth22Ethernet(self.caveHost, self.cavePort) except: self.shm.tempCave = 999.9 self.shm.humCave = 999.9 self.shm.presenceCave = 0 self.shm.tempPC = float(self.get_ArduinoValue(self.oidTempPC, self.Host)) / 10.0 self.shm.humPC = float(self.get_ArduinoValue(self.oidHumidPC, self.Host)) / 10.0 self.shm.tempSdb = float(self.get_ArduinoValue(self.oidTempSdB, self.Host)) / 10.0 self.shm.humSdb = float(self.get_ArduinoValue(self.oidHumidSdB, self.Host)) / 10.0 self.shm.tempSalon = float(self.get_ArduinoValue(self.oidTempSalon, self.Host)) / 10.0 self.shm.humSalon = float(self.get_ArduinoValue(self.oidHumidSalon, self.Host)) / 10.0 self.shm.tempExt = float(self.get_ArduinoValue(self.oidTempExt, self.Host)) / 10.0 self.shm.humExt = float(self.get_ArduinoValue(self.oidHumidExt, self.Host)) / 10.0 DomoData.write_file(self, self.filePath)