ENEN DEDE
home
Station ladebereit

Code von Benjamin zum ein- und ausschalten des Monitors:

/usr/local/bin/emob/scrreen.py

#!/usr/bin/env python

import time
import subprocess
import MySQLdb as mdb

from datetime import datetime

try:
        while True:
                con = mdb.connect('localhost', 'DB_User', 'Password', 'emob');
                cur = con.cursor()
                cur.execute("SELECT loading FROM emob.settings")
                ldata = cur.fetchone ()
                if ldata == (1L,):
                        subprocess.call( "vcgencmd display_power 1", shell=True )
                        time.sleep(600)         # 10 Minuten Nachlaufzeit.
                else:
                        time.sleep(5)
                        subprocess.call( "vcgencmd display_power 0", shell=True )

        else:
                time.sleep(5)

except mdb.Error, e:
        print "Error %d: %s" % (e.args[0],e.args[1])
        sys.exit(1)
finally:
        if con:
                con.close()