Exemplo n.º 1
0
def chk_light():
    logger.info('checking Lighmode')

    param = user_cfg['light']  #User Parameter Licht
    SysTime = data['dt']['tp']  #systemzeit tupel

    return

    #Sonnenaufgang - sun_u
    c1 = param['sun']['up_start']  #startzeit [hh:mm]
    c2 = param['sun']['up_end']  #endzeit [hh:mm]
    sun_u, x3 = time_in_range(SysTime, c1, c2)  #Intervall prüfen

    x4 = int(x3 / 60)  #zeit bis wechsel in vollen minuten
    x3tx = bas.min_to_txt(x4)

    msg = ('%-18s %-5s %-5s %-5s %-5s %-5s' %
           ('Sonnenaufgang ', c1, c2, sun_u, x4, x3tx))
    if sun_u:
        gl_toggle = x4  #zeit bis wechsel in minuten
        gl_start = c1  #Startzeit [hh:mm]
        gl_end = c2  #Endzeit [hh:mm]

    logger.debug(msg)

    return
Exemplo n.º 2
0
	def run(self):
		msg=('%s %10s ID[%s]' % ('Thread gestartet',self.name,self.id ))
		logger.info(msg)
		#
		if	 self.id==0:  cr.tic (self.para)	#tic modul cr
		elif self.id==1:  lightread (self.para)	#light
		#
		duration=round((time.time()-self.dt),2)
		duration2=bas.sec_to_txt2(duration) if duration > 60 else ""
		#
		msg=('%s %10s ID[%s] %ss %s' % ('Thread beendet	 ',self.name,self.id,duration,duration2))
		logger.info(msg)
Exemplo n.º 3
0
def ini():
	#
	#Prüft auf Zeit innerhalb Start Ende Intervall 
	#Rückgabe Zeit bis zum nächsten Wechsel
	#https://stackoverflow.com/questions/10747974/how-to-check-if-the-current-time-is-in-range-in-python
	#
	#in:
	#   start datetime.time		intevall Startzeit
	#   end   datetime.time		intervall Endzeit
	#   x     datetime.time 	zu prüfende Zeit
	#
	#out:
	#	res bool  				true wenn innerhalt des Intervalls
	#	d   datetime.time		Zeit bis zum nächsten wechsel
	#
	
	msg='ini'
	logger.info(msg)

	#thread 0 tic  
	global thread_0
	id='0'
	name=th[id]['name']									#threat name
	mode=0												#Startparameter
	duration=0
	stic=0
	th[id]['exit']=False								#exit threat
	th[id]['para']=''				#startparameter
	thread_0 = my_threat(th[id])						#threat
	thread_0.setDaemon(True)   #thread endet mit dem Hauptprogramm
	thread_0.start()

	#thread 1 Light  
	global thread_1
	id='1'
	name=th[id]['name']									#threat name
	mode=0												#Startparameter
	duration=0
	stic=0
	th[id]['exit']=False								#exit threat
	th[id]['para']=name,mode,duration,stic				#startparameter
	thread_1 = my_threat(th[id])						#threat
	thread_1.setDaemon(True)   #thread endet mit dem Hauptprogramm
	thread_1.start()
	return
Exemplo n.º 4
0
def main(argv): 
	msg="-- SYMPHY2 START --"
	logger.info(msg)
	
	global data
	
	ini()	#initialisierung
		
	
	try:
		
		#raise NameError('HeyDu')
		

	
		'''
		Hauptschleife START
		'''
		while True:

			#print ('-')
			time.sleep(0.2)
			
			#raise NameError('HeyDu')
			#print ('-- main ---',data['dt']['asc'])

		'''
		Hauptschleife ENDE 
		'''
		return
		
		
		
	#FEHLER Hauptschleife
	except Exception:	
		if DEBUG2:
			raise			# Raise the error if DEBUG2=True
		msg='%s %s' %('Main Loop ',sys.exc_info()[1])
		logger.error(msg)
		
	finally:
		#cleanup
		clean()
		sys.exit
	return #from main
Exemplo n.º 5
0
def clean():
	#
	#Prüft auf Zeit innerhalb Start Ende Intervall 
	#Rückgabe Zeit bis zum nächsten Wechsel
	#https://stackoverflow.com/questions/10747974/how-to-check-if-the-current-time-is-in-range-in-python
	#
	#in:
	#   start datetime.time		intevall Startzeit
	#   end   datetime.time		intervall Endzeit
	#   x     datetime.time 	zu prüfende Zeit
	#
	#out:
	#	res bool  				true wenn innerhalt des Intervalls
	#	d   datetime.time		Zeit bis zum nächsten wechsel
	#
	global th
	th['0']['exit']=True
	th['1']['exit']=True
	#th['2']['exit']=True

	msg='cleanup'
	logger.info(msg)
	return 	
Exemplo n.º 6
0
def cron_m1():
	logger.info("TIC MIN")
	return 
Exemplo n.º 7
0
#eigene
import glb
from glb import sys_cfg, user_cfg, logger  # cfg parameter, logger
import bas
from symphy import cron

#globale Variablen aus modul glb
from glb import th  #thread variable
from glb import data  #daten variable

global th
global data

msg = 'modul %s  %s' % (bas.mod_name(), 'ok')
logger.info(msg)
"""
TIC
"""


def gettime():
    #
    #Aktuele Zeit und Datum als Dictionary
    #
    #out:  {'asc': asc,'epoch':epoch,'tp':tp}
    #
    # ofs=(time.timezone*-1) + (time.localtime().tm_isdst)*3600 #offset in sekunden zu utc
    # true=Sommerziet tp.tm_isdst==1 							#sommerzeit
    # tp= time.localtime(epoch)
    # tp= time.strptime(string,format)