Exemple #1
0
 def __init__(self, appname, clienttype):
     MQTTClientCore.__init__(self, appname, clienttype)
     self.clientversion = VERSION
     self.interval = self.cfg.INTERVAL
     self.clientversion = VERSION
     self.observer = ephem.Observer()
     self.observer.lat = '38'
     self.observer.lon = '-93'
     self.sun = ephem.Sun()
     self.moon = ephem.Moon()
     self.year = ""
     self.month = ""
     self.day = ""
     self.weekday = ""
     self.dow = ""
     self.doy = ""
     self.hour = ""
     self.mil_hour = ""
     self.ampm = ""
     self.minute = ""
     self.sunrise = ""
     self.utc_sunrise = ""
     self.sunset = ""
     self.utc_sunset = ""
     self.moonrise = ""
     self.utc_moonrise = ""
     self.moonset = ""
     self.utc_moonset = ""
     self.sunstate = ""
     self.moonstate = ""
     self.t = threading.Thread(target=self.do_thread_loop)
     self.t.start()
Exemple #2
0
 def __init__(self, appname, clienttype):
     MQTTClientCore.__init__(self, appname, clienttype)
     self.clientversion = VERSION
     self.interval = self.cfg.INTERVAL
     self.clientversion = VERSION
     self.observer = ephem.Observer()
     self.observer.lat = '38'
     self.observer.lon = '-93'
     self.sun = ephem.Sun()
     self.moon = ephem.Moon()
     self.year=""
     self.month=""
     self.day=""
     self.weekday=""
     self.dow=""
     self.doy=""
     self.hour=""
     self.mil_hour=""
     self.ampm=""
     self.minute=""
     self.sunrise=""
     self.utc_sunrise=""
     self.sunset=""
     self.utc_sunset=""
     self.moonrise=""
     self.utc_moonrise=""
     self.moonset=""
     self.utc_moonset=""
     self.sunstate=""
     self.moonstate=""
     self.t = threading.Thread(target=self.do_thread_loop)
     self.t.start()
Exemple #3
0
    def __init__(self, appname, clienttype):
        MQTTClientCore.__init__(self, appname, clienttype)
        self.clientversion = VERSION
        self.watchtopic = WATCHTOPIC
        self.serialport = self.cfg.SERIAL_PORT

        t = threading.Thread(target=self.do_thread_loop)
        t.start()
Exemple #4
0
 def __init__(self, appname, clienttype):
     MQTTClientCore.__init__(self, appname, clienttype)
     self.clientversion = VERSION
     self.watchtopic = WATCHTOPIC
     self.metarids = self.cfg.METAR_IDS
     self.interval = self.cfg.INTERVAL
     self.basetopic = self.cfg.BASE_TOPIC
     self.clientversion = VERSION
Exemple #5
0
 def __init__(self, appname, clienttype):
     MQTTClientCore.__init__(self, appname, clienttype)
     self.clientversion = VERSION
     self.watchtopic = WATCHTOPIC
     self.workingdir = self.cfg.WORKINGDIR
     self.clienttopic = "/clients/" + APPNAME
     self.quotes = []
     self.do_read_quotes()
    def __init__(self, appname, clienttype):
        MQTTClientCore.__init__(self, appname, clienttype)
        self.clientversion = VERSION
        self.watchtopic = WATCHTOPIC
        self.counties = self.cfg.COUNTIES
        self.interval = self.cfg.INTERVAL
        self.basetopic = self.cfg.BASE_TOPIC

        self.previous = dict()
Exemple #7
0
 def on_message(self, mself, obj, msg):
     MQTTClientCore.on_message(self, mself, obj, msg)
     if (msg.topic == self.clientbase + "ping"):
         pass  #ugly here TODO
     else:
         topic = msg.topic.split("/")
         if (( topic[1] == "clients" ) and ( topic[3] == "ping") and ( msg.payload == "response" )):        
             self.response[topic[2]] = True
             print "reponse from ", topic[2]
    def __init__(self, appname, clienttype):
        MQTTClientCore.__init__(self, appname, clienttype)
        self.clientversion = VERSION
        self.watchtopic = WATCHTOPIC
        self.counties = self.cfg.COUNTIES
        self.interval = self.cfg.INTERVAL
        self.basetopic = self.cfg.BASE_TOPIC

        self.previous = dict()
Exemple #9
0
 def __init__(self, appname, clienttype):
     MQTTClientCore.__init__(self, appname, clienttype)
     self.clientversion = VERSION
     self.watchtopic = WATCHTOPIC
     self.clientversion = VERSION 
     self.alarmfile = self.cfg.ALARMFILE
     self.interval = 15
     self.t = threading.Thread(target=self.do_thread_loop)
     self.t.start()
Exemple #10
0
 def on_message(self, mself, obj, msg):
     MQTTClientCore.on_message(self, mself, obj, msg)
     if (msg.topic == self.watchtopic):
         if ((msg.topic == self.watchtopic + "/message") and
                 (msg.payload != "")):
             self.voicec.login()
             sms_msg = msg.payload.split(':')
             print "Sending SMS to: ", sms_msg[0]
             print "Message: ", sms_msg[1]
             self.voicec.send_sms(sms_msg[0], sms_msg[1])
Exemple #11
0
 def on_message(self, mself, obj, msg):
     MQTTClientCore.on_message(self, mself, obj, msg)
     if (msg.topic == self.watchtopic):
         if (msg.payload == "trigger"):
             self.t = threading.Thread(target=self.do_thread_loop)
             self.t.start()
     if (msg.topic == "/raw/clock/minute"):
         if (msg.payload == "3"):
             self.t = threading.Thread(target=self.do_thread_loop)
             self.t.start()
 def on_message(self, mself, obj, msg):
     MQTTClientCore.on_message(self, mself, obj, msg)
     if (msg.topic == self.watchtopic):
         if (msg.payload == "trigger"):
             self.t = threading.Thread(target=self.do_thread_loop)
             self.t.start()
     if (msg.topic == "/raw/clock/minute"):
         if (msg.payload == "5"):
             self.t = threading.Thread(target=self.do_thread_loop)
             self.t.start()
Exemple #13
0
 def on_message(self, mself, obj, msg):
     MQTTClientCore.on_message(self, mself, obj, msg)
     if ( msg.topic == self.watchtopic ):
         if ( msg.payload == "stolen" ):
             p2 = subprocess.Popen( "/usr/bin/amixer set Master 100" )
             p3 = subprocess.Popen( "/usr/bin/amixer set Master unmute" )
             p = subprocess.Popen( "mplayer " + self.alarmfile, shell = True )
             p.wait()
             print "stolen"
     else:
         print "unknown command"
Exemple #14
0
    def __init__(self, appname, clienttype):
        MQTTClientCore.__init__(self, appname, clienttype)
        self.clientversion = VERSION
        self.watchtopic = WATCHTOPIC
        self.monitorlist = self.cfg.MONITOR_LIST
        self.interval = self.cfg.INTERVAL
        self.pause = self.cfg.PAUSE
        self.clientversion = VERSION
        self.response = {}

        self.t = threading.Thread(target=self.do_thread_loop)
Exemple #15
0
 def on_message(self, mself, obj, msg):
     MQTTClientCore.on_message(self, mself, obj, msg)
     if (msg.topic == '/raw/clock/day'):
         self.do_quote()
     if (msg.topic == self.watchtopic):
         if(msg.payload == "update"):
             self.do_read_quotes()
     if (msg.topic == self.watchtopic):
         if(msg.payload == "list"):
             self.do_list_quotes()
     if (msg.topic == self.watchtopic):
         if(msg.payload == "quote"):
             self.do_quote()
Exemple #16
0
 def __init__(self, appname, clienttype):
     MQTTClientCore.__init__(self, appname, clienttype)
     self.clientversion = VERSION
     self.watchtopic = WATCHTOPIC
     self.tickerlist = self.cfg.STOCK_TICKERS
     self.interval = self.cfg.INTERVAL
     self.basetopic = self.cfg.BASE_TOPIC
     self.stocktickers = self.cfg.STOCK_TICKERS
     self.openhour = self.cfg.OPEN_TIME_HOUR
     self.openmin = self.cfg.OPEN_TIME_MIN
     self.closehour = self.cfg.CLOSE_TIME_HOUR
     self.closemin = self.cfg.CLOSE_TIME_MIN
     self.tradingdow = self.cfg.TRADING_DOW
Exemple #17
0
 def __init__(self, appname, clienttype):
     MQTTClientCore.__init__(self, appname, clienttype)
     self.clientversion = VERSION
     self.watchtopic = WATCHTOPIC
     self.voicec = Voice()
 def on_connect(self, mself, obj, rc):
     MQTTClientCore.on_connect(self, mself, obj, rc)
     self.mqttc.subscribe("$SYS/#", qos=2)
 def on_connect(self, mself, obj, rc):
     MQTTClientCore.on_connect(self, mself, obj, rc)
     self.mqttc.subscribe(self.watchtopic, qos=2)
     self.mqttc.subscribe("/raw/clock/minute")
    def __init__(self, appname, clienttype):
        self.q = Queue.Queue(200)
        MQTTClientCore.__init__(self, appname, clienttype)
        self.clientversion = VERSION
        self.watchtopic = WATCHTOPIC
        self.workingdir = self.cfg.WORKINGDIR
    	self.interval = self.cfg.INTERVAL
        self.root = Tk()
        #build UI

        self.root.title("MQTT Dashboard")
        frame = Frame(self.root)
        frame.pack()
        host_ofx=0
        Label(frame, text="Hostname:").grid(row=host_ofx, column=0, sticky=W)
        self.host_text = Text(frame, height=1, width=30)
        self.host_text.grid(row=host_ofx, column=1, columnspan=3, sticky=W)
        self.host_text.delete(1.0, END)
        self.host_text.insert(END, self.mqtthost)
        self.button_connect = Button(frame, text="Connect", command=connect)
        self.button_connect.grid(row=host_ofx, column=4, columnspan=2, sticky=W)
        self.button_disconnect = Button(frame, text="Disconnect", command=disconnect)
        self.button_disconnect.grid(row=host_ofx, column=5, columnspan=2)

        fill0_ofx=host_ofx+1
        Label(frame, text="").grid(row=fill0_ofx, column=0)

        version_ofx=fill0_ofx+1
        Label(frame, text="Version:").grid(row=version_ofx, column=0, sticky=W)
        self.version_text = Text(frame, height=1, width=30, state=DISABLED)
        self.version_text.grid(row=version_ofx, column=1, columnspan=3)
        self.revision_text = Text(frame, height=1, width=30, state=DISABLED)
        self.revision_text.grid(row=version_ofx, column=4, columnspan=3)
        self.timestamp_text = Text(frame, height=1, width=30, state=DISABLED)
        self.timestamp_text.grid(row=version_ofx, column=7, columnspan=3)

        fill1_ofx=version_ofx+1
        Label(frame, text="").grid(row=fill1_ofx, column=0)

        load_ofx=fill1_ofx+1
        Label(frame, text="Load:").grid(row=load_ofx, column=0, sticky=W)
        Label(frame, text="Per Sec").grid(row=load_ofx, column=1, columnspan=2)
        Label(frame, text="Per 1 Min").grid(row=load_ofx, column=3, columnspan=2)
        Label(frame, text="Per 5 Min").grid(row=load_ofx, column=5, columnspan=2)
        Label(frame, text="Per 15 Min").grid(row=load_ofx, column=7, columnspan=2)
        Label(frame, text="Total").grid(row=load_ofx, column=9, columnspan=2)

        Label(frame, text="Received").grid(row=load_ofx+1, column=2)
        Label(frame, text="Sent").grid(row=load_ofx+1, column=1)
        Label(frame, text="Received").grid(row=load_ofx+1, column=4)
        Label(frame, text="Sent").grid(row=load_ofx+1, column=3)
        Label(frame, text="Received").grid(row=load_ofx+1, column=6)
        Label(frame, text="Sent").grid(row=load_ofx+1, column=5)
        Label(frame, text="Received").grid(row=load_ofx+1, column=8)
        Label(frame, text="Sent").grid(row=load_ofx+1, column=7)
        Label(frame, text="Received").grid(row=load_ofx+1, column=10)
        Label(frame, text="Sent").grid(row=load_ofx+1, column=9)

        Label(frame, text="Bytes").grid(row=load_ofx+2, column=0, sticky=W)
        self.bytes_ss_text = Text(frame, height=1, width=10, state=DISABLED)
        self.bytes_ss_text.grid(row=load_ofx+2, column=1)
        self.bytes_sr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.bytes_sr_text.grid(row=load_ofx+2, column=2)
        self.bytes_1ms_text = Text(frame, height=1, width=10, state=DISABLED)
        self.bytes_1ms_text.grid(row=load_ofx+2, column=3)
        self.bytes_1mr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.bytes_1mr_text.grid(row=load_ofx+2, column=4)
        self.bytes_5ms_text = Text(frame, height=1, width=10, state=DISABLED)
        self.bytes_5ms_text.grid(row=load_ofx+2, column=5)
        self.bytes_5mr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.bytes_5mr_text.grid(row=load_ofx+2, column=6)
        self.bytes_15ms_text = Text(frame, height=1, width=10, state=DISABLED)
        self.bytes_15ms_text.grid(row=load_ofx+2, column=7)
        self.bytes_15mr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.bytes_15mr_text.grid(row=load_ofx+2, column=8)
        self.bytes_ts_text = Text(frame, height=1, width=16, state=DISABLED)
        self.bytes_ts_text.grid(row=load_ofx+2, column=9)
        self.bytes_tr_text = Text(frame, height=1, width=16, state=DISABLED)
        self.bytes_tr_text.grid(row=load_ofx+2, column=10)

        Label(frame, text="Messages").grid(row=load_ofx+3, column=0, sticky=W)
        self.messages_ss_text = Text(frame, height=1, width=10, state=DISABLED)
        self.messages_ss_text.grid(row=load_ofx+3, column=1)
        self.messages_sr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.messages_sr_text.grid(row=load_ofx+3, column=2)
        self.messages_1ms_text = Text(frame, height=1, width=10, state=DISABLED)
        self.messages_1ms_text.grid(row=load_ofx+3, column=3)
        self.messages_1mr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.messages_1mr_text.grid(row=load_ofx+3, column=4)
        self.messages_5ms_text = Text(frame, height=1, width=10, state=DISABLED)
        self.messages_5ms_text.grid(row=load_ofx+3, column=5)
        self.messages_5mr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.messages_5mr_text.grid(row=load_ofx+3, column=6)
        self.messages_15ms_text = Text(frame, height=1, width=10, state=DISABLED)
        self.messages_15ms_text.grid(row=load_ofx+3, column=7)
        self.messages_15mr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.messages_15mr_text.grid(row=load_ofx+3, column=8)
        self.messages_ts_text = Text(frame, height=1, width=16, state=DISABLED)
        self.messages_ts_text.grid(row=load_ofx+3, column=9)
        self.messages_tr_text = Text(frame, height=1, width=16, state=DISABLED)
        self.messages_tr_text.grid(row=load_ofx+3, column=10)

        Label(frame, text="Published").grid(row=load_ofx+4, column=0, sticky=W)
#        self.publish_ss_text = Text(frame, height=1, width=10, state=DISABLED)
#        self.publish_ss_text.grid(row=5+1, column=1)
#        self.publish_sr_text = Text(frame, height=1, width=10, state=DISABLED)
#        self.publish_sr_text.grid(row=load_ofx+4, column=2)
        self.publish_1ms_text = Text(frame, height=1, width=10, state=DISABLED)
        self.publish_1ms_text.grid(row=load_ofx+4, column=3)
        self.publish_1mr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.publish_1mr_text.grid(row=load_ofx+4, column=4)
        self.publish_5ms_text = Text(frame, height=1, width=10, state=DISABLED)
        self.publish_5ms_text.grid(row=load_ofx+4, column=5)
        self.publish_5mr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.publish_5mr_text.grid(row=load_ofx+4, column=6)
        self.publish_15ms_text = Text(frame, height=1, width=10, state=DISABLED)
        self.publish_15ms_text.grid(row=load_ofx+4, column=7)
        self.publish_15mr_text = Text(frame, height=1, width=10, state=DISABLED)
        self.publish_15mr_text.grid(row=load_ofx+4, column=8)
#        self.publish_ts_text = Text(frame, height=1, width=10, state=DISABLED)
#        self.publish_ts_text.grid(row=load_ofx+4, column=9)
#        self.publish_tr_text = Text(frame, height=1, width=10, state=DISABLED)
#        self.publish_tr_text.grid(row=load_ofx+4, column=10)

        Label(frame, text="Connections").grid(row=load_ofx+5, column=0, sticky=W)
#        self.connections_s_text = Text(frame, height=1, width=20, state=DISABLED)
#        self.connections_s_text.grid(row=load_ofx+5, column=1, columnspan=2)
        self.connections_1m_text = Text(frame, height=1, width=21, state=DISABLED)
        self.connections_1m_text.grid(row=load_ofx+5, column=3, columnspan=2)
        self.connections_5m_text = Text(frame, height=1, width=21, state=DISABLED)
        self.connections_5m_text.grid(row=load_ofx+5, column=5, columnspan=2)
        self.connections_15m_text = Text(frame, height=1, width=21, state=DISABLED)
        self.connections_15m_text.grid(row=load_ofx+5, column=7, columnspan=2)
#        self.connections_t_text = Text(frame, height=1, width=20, state=DISABLED)
#        self.connections_t_text.grid(row=load_ofx+5, column=9, columnspan=2)

        Label(frame, text="Sockets").grid(row=load_ofx+6, column=0, sticky=W)
#        self.sockets_s_text = Text(frame, height=1, width=20, state=DISABLED)
#        self.sockets_s_text.grid(row=load_ofx+6, column=1, columnspan=2)
        self.sockets_1m_text = Text(frame, height=1, width=21, state=DISABLED)
        self.sockets_1m_text.grid(row=load_ofx+6, column=3, columnspan=2)
        self.sockets_5m_text = Text(frame, height=1, width=21, state=DISABLED)
        self.sockets_5m_text.grid(row=load_ofx+6, column=5, columnspan=2)
        self.sockets_15m_text = Text(frame, height=1, width=21, state=DISABLED)
        self.sockets_15m_text.grid(row=load_ofx+6, column=7, columnspan=2)
#        self.sockets_t_text = Text(frame, height=1, width=20, state=DISABLED)
#        self.sockets_t_text.grid(row=load_ofx+6, column=9, columnspan=2)

        fill2_ofx=load_ofx+7
        Label(frame, text="").grid(row=fill2_ofx, column=0)

        clients_ofx=fill2_ofx+1
        clients_ofy=0
        Label(frame, text="Clients:").grid(row=clients_ofx, column=clients_ofy, sticky=W)
        Label(frame, text="Active").grid(row=clients_ofx+1, column=clients_ofy+1, sticky=W)
        self.active_text = Text(frame, height=1, width=7, state=DISABLED)
        self.active_text.grid(row=clients_ofx+1, column=clients_ofy+2)
        Label(frame, text="Inactive").grid(row=clients_ofx+2, column=clients_ofy+1, sticky=W)
        self.inactive_text = Text(frame, height=1, width=7, state=DISABLED)
        self.inactive_text.grid(row=clients_ofx+2, column=clients_ofy+2)
        Label(frame, text="Total").grid(row=clients_ofx+3, column=clients_ofy+1, sticky=W)
        self.clients_total_text = Text(frame, height=1, width=7, state=DISABLED)
        self.clients_total_text.grid(row=clients_ofx+3, column=clients_ofy+2)
        Label(frame, text="Expired").grid(row=clients_ofx+4, column=clients_ofy+1, sticky=W)
        self.expired_text = Text(frame, height=1, width=7, state=DISABLED)
        self.expired_text.grid(row=clients_ofx+4, column=clients_ofy+2)
        Label(frame, text="Maximum").grid(row=clients_ofx+5, column=clients_ofy+1, sticky=W)
        self.max_text = Text(frame, height=1, width=7, state=DISABLED)
        self.max_text.grid(row=clients_ofx+5, column=clients_ofy+2)

        other_ofx=fill2_ofx+1
        other_ofy=8
        Label(frame, text="Other:").grid(row=other_ofx, column=other_ofy, sticky=W)
        Label(frame, text="Uptime").grid(row=other_ofx+1, column=other_ofy+1, sticky=W)
        self.uptime_text = Text(frame, height=1, width=16, state=DISABLED)
        self.uptime_text.grid(row=other_ofx+1, column=other_ofy+2)
        Label(frame, text="Heap Current").grid(row=other_ofx+2, column=other_ofy+1, sticky=W)
        self.heap_text = Text(frame, height=1, width=16, state=DISABLED)
        self.heap_text.grid(row=other_ofx+2, column=other_ofy+2)
        Label(frame, text="Heap Max.").grid(row=other_ofx+3, column=other_ofy+1, sticky=W)
        self.heap_max_text = Text(frame, height=1, width=16, state=DISABLED)
        self.heap_max_text.grid(row=other_ofx+3, column=other_ofy+2)
#        Label(frame, text="Bridges:").grid(row=other_ofx+4, column=other_ofy, sticky=W)
#        self.connections_text = Text(frame, height=3, width=8, state=DISABLED)
#        self.connections_text.grid(row=other_ofx+5, column=other_ofy+2, rowspan=3)

        msg_ofx=fill2_ofx+1
        msg_ofy=4
        Label(frame, text="Messages:").grid(row=msg_ofx, column=msg_ofy, sticky=W)
        Label(frame, text="Retained").grid(row=msg_ofx+1, column=msg_ofy+1, sticky=W)
        self.retained_text = Text(frame, height=1, width=7, state=DISABLED)
        self.retained_text.grid(row=msg_ofx+1, column=msg_ofy+2)
        Label(frame, text="Stored").grid(row=msg_ofx+2, column=msg_ofy+1, sticky=W)
        self.stored_text = Text(frame, height=1, width=7, state=DISABLED)
        self.stored_text.grid(row=msg_ofx+2, column=msg_ofy+2)
        Label(frame, text="Dropped").grid(row=msg_ofx+3, column=msg_ofy+1, sticky=W)
        self.dropped_text = Text(frame, height=1, width=7, state=DISABLED)
        self.dropped_text.grid(row=msg_ofx+3, column=msg_ofy+2)
        Label(frame, text="Inflight").grid(row=msg_ofx+4, column=msg_ofy+1, sticky=W)
        self.inflight_text = Text(frame, height=1, width=7, state=DISABLED)
        self.inflight_text.grid(row=msg_ofx+4, column=msg_ofy+2)
        Label(frame, text="Subscriptns").grid(row=msg_ofx+5, column=msg_ofy+1, sticky=W)
        self.subscriptions_text = Text(frame, height=1, width=7, state=DISABLED)
        self.subscriptions_text.grid(row=msg_ofx+5, column=msg_ofy+2)

        fill3_ofx=msg_ofx+8
        Label(frame, text="").grid(row=fill3_ofx, column=0)

        log_ofx=fill3_ofx+1
        Label(frame, text="Log:").grid(row=log_ofx, column=0, sticky=W)
        self.log_text = ScrolledText(frame, height=6, state=DISABLED)
        self.log_text.grid(row=log_ofx+1, column=0, columnspan=11, sticky=N+W+E+S)
        self.root.update()
        self.root.protocol("WM_DELETE_WINDOW", self.closehandler)
        self.root.update()
        self.t = threading.Thread(target=self.do_thread_loop)
Exemple #21
0
 def on_connect(self, mself, obj, rc):
     MQTTClientCore.on_connect(self, mself, obj, rc)
     self.mqttc.subscribe(self.watchtopic, qos=2)
     self.mqttc.subscribe("/raw/clock/minute")
Exemple #22
0
 def on_connect(self, mself, obj, rc):
     MQTTClientCore.on_connect(self, mself, obj, rc)
     n = pynotify.Notification("MQTT Connected.")
     n.show()
     for topic in self.watchtopic:
         self.mqttc.subscribe(topic, qos=2)
Exemple #23
0
 def __init__(self, appname, clienttype):
     MQTTClientCore.__init__(self, appname, clienttype)
     self.clientversion = VERSION
     self.watchtopic = self.cfg.WATCH_TOPICS
     #register with notification system
     pynotify.init(APPNAME)
Exemple #24
0
 def on_connect(self, mself, obj, rc):
     MQTTClientCore.on_connect(self, mself, obj, rc)
     self.mqttc.subscribe(self.watchtopic, 2)
def connect():
    MQTTClientCore.mqtt_connect(daemon.mqttcore)
Exemple #26
0
 def on_disconnect(self, mself, obj, rc):
     MQTTClientCore.on_disconnect(self, mself, obj, rc)
     print "MQTT Disconnected"
     n = pynotify.Notification("MQTT disconnected.")
     n.show()
Exemple #27
0
 def on_connect(self, mself, obj, rc):
     MQTTClientCore.on_connect(self, mself, obj, rc)
     self.mqttc.subscribe( "/clients" + "/+/ping", 2)
     self.t.start()
Exemple #28
0
 def on_message(self, mself, obj, msg):
     MQTTClientCore.on_message(self, mself, obj, msg)
     if not (msg.retain):
         n = pynotify.Notification(msg.topic, msg.payload)
         n.show()
Exemple #29
0
 def on_connect(self, mself, obj, rc):
     MQTTClientCore.on_connect(self, mself, obj, rc)
     self.mqttc.subscribe(self.watchtopic, qos=0)
     self.mqttc.subscribe('/raw/clock/day', qos=0)
 def on_message(self, mself, obj, msg):
     MQTTClientCore.on_message(self, mself, obj, msg)
     obj.put(msg)
Exemple #31
0
 def on_disconnect(self, mself, obj, rc):
     MQTTClientCore.on_disconnect(self, mself, obj, rc)
     print "MQTT Disconnected"
def disconnect():
    MQTTClientCore.mqtt_disconnect(daemon.mqttcore)