def comprobar_ecosystem(): ecoluz = ParamikoComando() ecoluz.conectar() comando = 'ecosystem.py' if ecoluz.pid(comando) != []: session['ecosystem'] = 1 else: session['ecosystem'] = 0
def comprobar_camara(): camara = ParamikoComando() camara.conectar() comando = 'camara.py' if camara.pid(comando) != []: session['camara'] = 1 else: session['camara'] = 0
def comprobar_timelaps(): timelaps = ParamikoComando() timelaps.conectar() comando = 'fotos.py' if timelaps.pid(comando) != []: session['timelaps'] = 1 return True else: session['timelaps'] = 0 return False
def matar_datosdh22(): automatic = ParamikoComando() automatic.conectar() try: ####MATANDO SENSOR########## print('matando datosdh22.py') comando = 'datosdh22.py' for pid in automatic.pid(comando): pid_a_matar = pid.strip('\n') automatic.matar(pid_a_matar) except: pass automatic.client.close()
def matar_automatic(): automatic = ParamikoComando() automatic.conectar() try: ####MATANDO AUTIMATIC.PY################## print('matando automatic.py') comando = 'automatic.py' for pid in automatic.pid(comando): pid_a_matar = pid.strip('\n') automatic.matar(pid_a_matar) except: pass automatic.client.close()
def matar_ecosystem(): ecoluz = ParamikoComando() ecoluz.conectar() comando = 'ecosystem.py' try: ####MATANDO ECOSYSTEM.PY################## print('matando ecosystem.py') for pid in ecoluz.pid(comando): pid_a_matar = pid.strip('\n') ecoluz.matarsig(pid_a_matar) session['ecosystem'] = 0 except: pass ecoluz.client.close() print('Ecosystem apagado')
def matar_timelaps(): timelaps = ParamikoComando() timelaps.conectar() comando = 'fotos.py' try: ####MATANDO FOTOS.PY################## print('matando fotos.py') for pid in timelaps.pid(comando): pid_a_matar = pid.strip('\n') timelaps.matarsig(pid_a_matar) session['timelaps'] = 0 except: pass timelaps.client.close() print('Timelaps apagado')
def matar_camara(): camara = ParamikoComando() camara.conectar() comando = 'camara.py' try: ####MATANDO CAMARA.PY################## print('matando camara.py') for pid in camara.pid(comando): pid_a_matar = pid.strip('\n') camara.matarsig(pid_a_matar) session['camara'] = 0 except: pass camara.client.close() print('Camara apagada')
def encender_sensorDHT22(): sensor = ParamikoComando() sensor.conectar() try: comando = 'pigpiod_py.py' sensor.ejecutarcomando(comando, False) except: pass comando = 'datosdh22.py' if sensor.pid(comando) != []: print('El sensor DHT22 ya esta encendido') else: sensor.ejecutarcomando(comando, False) print('Sensor DHT22 encendido') #sensor.client.close() return True
def comprobar_automatic(): global TRABAJANDO try: automatic = ParamikoComando() automatic.conectar() comando = 'automatic.py' if automatic.pid(comando) != []: TRABAJANDO = True encender_sensorDHT22() ultima_conf = Historial.query.order_by(Historial.id.desc()).first() session['nombre_conf'] = ultima_conf.nombre_conf confi = Configuracion.query.filter_by( nombre_conf=session['nombre_conf']).first() session['tipo_cultivo'] = confi.tipo_cultivo session['luz'] = confi.luz session['humedad_suelo'] = confi.humedad_suelo session['riego'] = confi.riego session['cantidad_riego'] = confi.cantidad_riego session['humedad_min'] = confi.humedad_min session['humedad_max'] = confi.humedad_max session['temperatura_min'] = confi.temperatura_min session['temperatura_max'] = confi.temperatura_max session['ventilador'] = confi.ventilador session['cantidad_ventilador'] = confi.cantidad_ventilador session['ph_min'] = confi.ph_min session['ph_max'] = confi.ph_max session['ec_min'] = confi.ec_min session['ec_max'] = confi.ec_max session['trabajando'] = True session['inicio'] = confi.inicio return True else: TRABAJANDO = False session['trabajando'] = False automatic.client.close() except: pass