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 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()
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])
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"
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()
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()
def on_message(self, mself, obj, msg): MQTTClientCore.on_message(self, mself, obj, msg) obj.put(msg)