コード例 #1
0
ファイル: anwesenheit.py プロジェクト: chrihuc/steuerzentrale
 def check_handy (self, ip, wert):   
     if ping(ip):
         return ping_max
     else:
         wert -= 1
     if wert <= ping_urlaub:
         wert = ping_urlaub
     return wert
コード例 #2
0
ファイル: inp_xs1.py プロジェクト: chrihuc/steuerzentrale
def main():  
    global heartbeat
    global ldt
    zeit =  time.time()
    now = (strftime("%Y-%m-%d %H:%M:%S",localtime(zeit)))  
    setting_s("Laststart", str(now))
    if selfsupervision:
        while not ping(constants.router_IP):
            #reset_wlan()
            time.sleep(60)        
    heartbeat = Timer(constants.heartbt, heartbeat_sup)
    heartbeat.start()
    ezcontrol.SetSwitchFunction("heartbeat", "1") 
    ldt = Timer(2, last_data_reset)
    conn = pycurl.Curl()  
    conn.setopt(pycurl.URL, constants.xs1_.STREAM_URL)  
    conn.setopt(pycurl.WRITEFUNCTION, on_receive)
    #aes.new_event(description="XS1inputs neugestartet", prio=0)
    conn.perform()
コード例 #3
0
ファイル: inp_xs1.py プロジェクト: chrihuc/steuerzentrale
def heartbeat_sup():
  if selfsupervision:
    zeit =  time.time()
    now = (strftime("%Y-%m-%d %H:%M:%S",localtime(zeit)))  
    setting_s("Autorestart", str(now))
    count = int(setting_r("NumRestart"))
    if count == 0:
        aes.new_event(description="Verbindung unterbrochen XS1inputs", prio=1)
    if ((count > 0) and (setting_r("XS1_off") == "inactive")):
        aes.new_event(description="XS1 nicht erreichbar", prio=2)
        setting_s("XS1_off", "Active")
    setting_s("NumRestart", str(count + 1))
    exectext = "sudo killall python"
    print "connection lost"
    if ping(constants.router_IP):
        os.system(exectext)
    else:
        reset_wlan()
        os.system(exectext)   
コード例 #4
0
ファイル: inp_udp_o.py プロジェクト: chrihuc/steuerzentrale
##mail
#from email.mime.text import MIMEText
#from subprocess import Popen, PIPE
from mysql_con import setting_r, mdb_marantz_r, mdb_marantz_s, mdb_fern_r_neu, app_r, mdb_hue_s, mdb_sideb_s
from szenen import setting_s, set_szene, hue_set_szene, set_TF_LEDs
from messaging import messaging
from alarmevents import alarm_event
#from text_to_sonos import downloadAudioFile
from tablecontrol import tablecontrol

########################
#Variablen declarification
########################

aes = alarm_event()
if not (ping('192.168.192.190')):
    aes.new_event(description="Hue nicht erreichbar", prio=2)
if not (ping('192.168.192.4')):
    aes.new_event(description="XS1 nicht erreichbar", prio=2)        

ezcontrol = myezcontrol(constants.xs1_.IP,constants.xs1_.USER,constants.xs1_.PASS)

PORT_NUMBER = 5000
SIZE = 1024

no_event_list = ["Toggle_Kueche","TV_Channel_up","TV_Channel_down","Marantz_leiser","Marantz_lauter"]

tc = tablecontrol()

hostName = gethostbyname( constants.eigene_IP )