예제 #1
0
 def on_match_device_status_update(self, topic, headers, message, match):
     device_info = topic.split('/')
     device_id = device_info[6]
     device_type = device_info[5]
     page_load_helper.page_load(device_id, device_type, message[0])
     _log.debug("Topic: {topic}, Headers: {headers}, "
                      "Message: {message}".format(
                      topic=topic, headers=headers, message=message))
     topic = topic.split('/')
     topic_to_tcp = '/ui/web/'+topic[5]+'/'+topic[4]+'/'+topic[6]+'/'+topic[7]+'/'+topic[8]
     self.publish(str(topic_to_tcp), headers, str(message))
예제 #2
0
 def on_match_device_status_update(self, topic, headers, message, match):
     device_info = topic.split('/')
     device_id = device_info[6]
     device_type = device_info[5]
     page_load_helper.page_load(device_id, device_type, message[0])
     _log.debug("Topic: {topic}, Headers: {headers}, "
                "Message: {message}".format(topic=topic,
                                            headers=headers,
                                            message=message))
     topic = topic.split('/')
     topic_to_tcp = '/ui/web/' + topic[5] + '/' + topic[4] + '/' + topic[
         6] + '/' + topic[7] + '/' + topic[8]
     self.publish(str(topic_to_tcp), headers, str(message))
예제 #3
0
 def on_match_hue_page_load(self, topic, headers, message, match):
     device_info = topic.split('/')
     device_id = device_info[6]
     device_type = device_info[5]
     page_load_helper.page_load(device_id, device_type, message[0])
     if message:
         print 'success, thermostat updated'+str(message).strip('[]')
     _log.debug("Topic: {topic}, Headers: {headers}, "
                      "Message: {message}".format(
                      topic=topic, headers=headers, message=message))
     topic = device_info
     topic_to_tcp = '/ui/web/'+topic[5]+'/'+topic[4]+'/'+topic[6]+'/'+topic[7]+'/'+topic[8]
     self.publish(str(topic_to_tcp), headers, str(message))
예제 #4
0
 def on_match_hue_page_load(self, topic, headers, message, match):
     device_info = topic.split('/')
     device_id = device_info[6]
     device_type = device_info[5]
     page_load_helper.page_load(device_id, device_type, message[0])
     if message:
         print 'success, thermostat updated' + str(message).strip('[]')
     _log.debug("Topic: {topic}, Headers: {headers}, "
                "Message: {message}".format(topic=topic,
                                            headers=headers,
                                            message=message))
     topic = device_info
     topic_to_tcp = '/ui/web/' + topic[5] + '/' + topic[4] + '/' + topic[
         6] + '/' + topic[7] + '/' + topic[8]
     self.publish(str(topic_to_tcp), headers, str(message))
예제 #5
0
 def on_match_device_status_update(self, topic, headers, message, match):
     '''Handle message and send to browser.'''
     print os.path.basename(__file__) + "@on_match_device_status_update"
     print "message:" + str(message)
     device_info = topic.split('/')
     device_id = device_info[6]
     device_type = device_info[5]
     page_load_helper.page_load(device_id, device_type, message[0])
     _log.debug("Topic: {topic}, Headers: {headers}, "
                "Message: {message}".format(topic=topic,
                                            headers=headers,
                                            message=message))
     topic = topic.split('/')
     topic_to_tcp = '/ui/web/' + topic[5] + '/' + topic[4] + '/' + topic[
         6] + '/' + topic[7] + '/' + topic[8]
     print topic_to_tcp
     self.publish(str(topic_to_tcp), headers, str(message))
예제 #6
0
 def on_match_device_status_occupancy(self, topic, headers, message, match):
     print "inside subscribe method of occupancy sensor"
     print "message:" + str(message)
     device_info = topic.split('/')
     device_id = device_info[6]
     device_type = device_info[5]
     page_load_helper.page_load(device_id, device_type, message[0])
     if message:
         print 'occupancy status received' + str(message).strip('[]')
     _log.debug("Topic: {topic}, Headers: {headers}, "
                "Message: {message}".format(topic=topic,
                                            headers=headers,
                                            message=message))
     topic = device_info
     topic_to_tcp = '/ui/web/' + topic[5] + '/' + topic[4] + '/' + topic[
         6] + '/' + topic[7] + '/' + topic[8]
     print topic_to_tcp
     self.publish(str(topic_to_tcp), headers, str(message))